Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can anyone help me with this Java program? To design a hotel reservation system.

ID: 3567186 • Letter: C

Question

Can anyone help me with this Java program?
To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

check room availability
book a room (which will save clients name and number of days
cancel a room
provide room rate
print information for room: client info, number of days booked, rate, room number (if not book, should return a message saying it's available and the rate)
quit (the application)

The application should ensure a valid choice is entered, then process the choice. Once done, assuming the choice wasn't to quit, the menu is displayed and ready for another choice.
Thank you in advance! Can anyone help me with this Java program?
To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

check room availability
book a room (which will save clients name and number of days
cancel a room
provide room rate
print information for room: client info, number of days booked, rate, room number (if not book, should return a message saying it's available and the rate)
quit (the application)

The application should ensure a valid choice is entered, then process the choice. Once done, assuming the choice wasn't to quit, the menu is displayed and ready for another choice.
Thank you in advance!
To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

check room availability
book a room (which will save clients name and number of days
cancel a room
provide room rate
print information for room: client info, number of days booked, rate, room number (if not book, should return a message saying it's available and the rate)
quit (the application)

The application should ensure a valid choice is entered, then process the choice. Once done, assuming the choice wasn't to quit, the menu is displayed and ready for another choice. To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

check room availability
book a room (which will save clients name and number of days
cancel a room
To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

check room availability
To design a hotel reservation system. The hotel will have nine rooms, rooms 1-3 are $100/night, 4-6 are $200/night, and 7-9 are $300/night. The application will provide a list to choose from with the following options:

provide room rate
print information for room: client info, number of days booked, rate, room number (if not book, should return a message saying it's available and the rate)
quit (the application)

The application should ensure a valid choice is entered, then process the choice. Once done, assuming the choice wasn't to quit, the menu is displayed and ready for another choice.
Thank you in advance!

Explanation / Answer

import java.util.Scanner;
public class Maxof2
{
public static void main(String args[])
{
int[] rooms = new int[9];
boolean[] avail = new boolean[] {false, false, false, false, false, false, false, false, false};
int[] price = new int[] {100, 100, 100, 200, 200, 200, 300, 300, 300};
String[] client = new String[9];
int[] ndays = new int[9];

Scanner in = new Scanner(System.in);
int flag = 0;
do
{
  
System.out.println("1. check room availability");
System.out.println("2. book a room");
System.out.println("3. cancel a room ");
System.out.println("4. provide room rate");
System.out.println("5. print information");
System.out.println("6. exit");

System.out.println("Enter your choice: ");
int choice = in.nextInt();

switch(choice)
{
case 1:
System.out.println("Rooms: ");
for(int i=0; i<9; i++)
System.out.println("Room "+(i+1)+": "+avail[i]);
  
System.out.println();
break;

case 2:
System.out.println("Which room to book wnter: ");
int x = in.nextInt();
  
if(avail[x-1] == false)
{
avail[x-1] = true;
System.out.println("Enter name:");
client[x-1] = in.nextLine();
System.out.println("Enter days:");
ndays[x-1] = in.nextInt();
System.out.println("Room booked !! ");
}
else
{
System.out.println("Room already booked !! ");
}
  
System.out.println();
break;

case 3:
System.out.println("Which room to cancel:");
int x1 = in.nextInt();
  
if(avail[x1-1] == false)
{
System.out.println("no room booked !! ");
}
else
{
System.out.println("Room cancelled !! ");
avail[x1-1] = false;
}
break;
  
case 4:
System.out.println("Which room rate you want?:");
int x2 = in.nextInt();
  
System.out.println("Room "+(x2)+" rent is: $"+price[x2-1]);
System.out.println();
break;
  
case 5:
for(int i=0; i<9; i++)
{
System.out.println("Room :"+(i+1)+" info-->");
if(avail[i] == true)
{
  
System.out.println("name: "+client[i]);
System.out.println("days: "+ndays[i]);
System.out.println("rate: "+price[i]);
}
else
{
  
System.out.println("Room not booked !! ");
}
System.out.println();
}
break;

case 6:
flag = 1;
break;
  
default: break;
}

}while(flag == 0);


return;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote