How to make hotel reservation system in java?

8
Mitchel Bogisich asked a question: How to make hotel reservation system in java?
Asked By: Mitchel Bogisich
Date created: Tue, Feb 2, 2021 10:19 AM
Date updated: Thu, Jun 30, 2022 1:36 AM

Content

Top best answers to the question «How to make hotel reservation system in java»

  • to create a reservation you need: 1) enter the reservation id, 2) select the client who will reserve, 3) you need to select the room where the client will stay. - if the user enter all required informations. - if the user enter a date in that is equal or come after the current day date.

7 other answers

Creates A new Reservation Object from user Input. */ public Reservation (String name, String dateFrom, boolean resType, int nights, int roomsNum, String roomType, int adults, int children, boolean breakfast, double deposit){this. number = (int) (Math. random() * 1000); this. name = name; this. dateF = dateFrom; String [] f = dateFrom. split(" / "); int d = Integer. parseInt(f[0]);

to create a reservation you need: 1) enter the reservation id, 2) select the client who will reserve, 3) you need to select the room where the client will stay. when you add a new reservation the system will check:

System. out. println(" There are no Rooms Booked with that name \n (make sure you've used the correct CAP's) "); private static void StoreProgramDataInToFile ( Room [] myHotel ) throws IOException {

the Hotel is an ArrayList of Reservations: it allows a person to request a room and cancel their reservation: also we can add more rooms */ import java.util.ArrayList; public class Hotel {// instance variable, ArrayList tracks current reservations: private ArrayList< Reservation > rooms; private int rnum = 1; // constructors, can specify how many rooms to start with

class Hotel { private String name, address; private List roomList; //key : roomNumber public Hotel(){ roomList = new ArrayList(); } public Reservation bookRoomForDates(List dateList, Guest guest){ for(Room room : roomList){ Reservation reservation = room.bookForGivenDates(dateList, guest); if(reserved != null) return reservation; //Reservation successFull!

if (numberOfNights <=2 && numberOfGuests == 1) {System.out.println("For" + numberOfGuests + " guest staying for " + numberOfNights + " nights, it will cost " + "€" + singleRoom);} else if (numberOfNights <=2 && numberOfGuests >1) {System.out.println("For " + numberOfGuests + " guests staying for " + numberOfNights + " nights, it will cost " + "€" + doubleRoom);}

add(hotel, Customer); // adds to the zero-th index. System.out.println(" "); } private static void add(String hotel[], String Customer){ for (int x =1; x <11; x++) { int z=0; String Customername = Customer; hotel[z]= Customername; // this line is the culprit.

Your Answer