Graderpractice for programmers

254275 OOP - Pre Mini Test 2 2/2563

Awaiting submission
Write a class named Hotel with fields for “name”, “totalroom” , totalfloor”and “address”. name
  public static void main(String[] args)
  {
    Hotel pisitpon = input();
    System.out.print("This hotel name is " +  pisitpon.getName() + " has a ");
    System.out.print( pisitpon.getTotalofroom() + " rooms in this hotel and they have ");
    System.out.println( pisitpon.getTotaloffloor() + " Floors");
    System.out.println("The location of this hotel is in "+ pisitpon.getAddress());
  }
  public static Hotel input()
  {
   Scanner pp = new Scanner(System.in);
   String name = pp.nextLine();
   int tr = Integer.parseInt(pp.nextLine());
   int tf = Integer.parseInt(pp.nextLine());
   String address =  pp.nextLine();
   return new Hotel(name,tr,tf,address);
  }
Awaiting submission
Add a new method to the Hotel named toString that returns word to say hello people to Who have come to stay here
Awaiting submission
A big Hotel has 300 or more room Add method named isBigHotel that return true if the numberofroom is a big hotel.
Awaiting submission
Write a methods named addRoom that adds x create a new room to the hotel where x is a parameters.
  public static void main(String[] args)
  {
      Scanner kb = new Scanner(System.in);
      String name = kb.nextLine();
      int tr = Integer.parseInt(kb.nextLine());
      int tf = Integer.parseInt(kb.nextLine());
      String address =  kb.nextLine();
      int addroom = Integer.parseInt(kb.nextLine());
      Hotel dunromch = new Hotel(name,tr,tf,address);
      dunromch.addRoom(addroom);
      System.out.println("The hotel has built "+addroom+" additional rooms");
      System.out.println("At this time the hotel "+dunromch.getName()+" has a total number of "+dunromch.getTotalofroom()+" rooms");
  }
Awaiting submission
A Residence is considered part of the hotel…. Create the residence class as a subclass of hotel, with an extra field for “name residence ” sumoffloor “ and checkfloor.
    public static void main(String[] args)
    {
        Residences Benzalert = input();
        System.out.print("This hotel name is " + Benzalert.getName() + " has ");
        System.out.print(Benzalert.getTotalofroom() + " rooms in this hotel and they have ");
        System.out.println(Benzalert.getTotaloffloor() + " Floors");
        System.out.println("The location of this hotel is in "+Benzalert.getAddress());
        System.out.println("And the Hotel has Residences name is "+Benzalert.getNameResidence()+" They have "+Benzalert.getSumoffloor()+" Floors");
    }

    public static Residences input()
    {
      Scanner kb = new Scanner(System.in);
      String name = kb.nextLine();
      int tr = Integer.parseInt(kb.nextLine());
      int tf = Integer.parseInt(kb.nextLine());
      String address =  kb.nextLine();
      String  nameresidence = kb.nextLine();
      int sumoffloor = Integer.parseInt(kb.nextLine());
      int ckf = kb.nextInt();
      return new Residences(name,tr,tf,address,nameresidence,sumoffloor,ckf);
    }
Awaiting submission
Every residence will have a Facility for the residents to use The Residences at Mandarin Oriental Bangkok There are the following Facility
  • Lobby F1
  • The Garden Loft , Game Room , Priavte Dining Room , Swimming pool , Playground & Kids Area F4
  • Gym & Fitness F5
  • The Oriental Salon(Sky Lounge) , Communal Kitchen Area , Library and office , Ball Room 36F