Question: JAVA PLS The Table class, which contains: A private data field named table_number. A private data field named capacity to represent the maximum number of
JAVA PLS
The Table class, which contains:
A private data field named table_number.
A private data field named capacity to represent the maximum number of persons the table can accommodate. Set the default value for this field to be 4.
A private data field named minimum_spend to represent the minimum amount customers need to spend at that table.
A private data field named vip_table which indicates whether a table is a VIP table or regular table.
A private table_count data field that tracks the number of tables created. This field is shared by all class members. The default is 0. Every time a table is created, this number should increment.
A no-arg constructor that increments the data field table_count, and uses the table count as a table_number for the created table.
A constructor that creates a table with the specified capacity and minimum spend (constructor arguments). This constructor should not take table ID as an argument. Instead, like the no-arg constructor, it increments the data field table_count, and uses the table count as a table_number for the created table.
Create getter and setter methods (accessors and mutators) for all data fields. Do not create a setter for table_count.
The Reservation class, which contains:
A private data field named reservation_number
A private data field named reservation_datetime which indicates the date and time of the reservation. Use the Date data type for this field.
A private data field named table to represent the table being reserved. This data type should be the Table class you created earlier.
A private data field named reserved_for to indicate the name of the person or group reserving the table.
A private data field named phone_number
A private data field named tables_reserved to track the total number of reservations at the restaurant. This data field is shared by all class members.
Create getter and setter methods (accessors and mutators) for all data fields. Do not create a setter for tables_reserved.
Create a constructor that takes two arguments: reserved_for and phone number. The constructor should set a reservation number (you can be creative in how you generate a reservation number), reservation datetime (create an instance of the Date class for this value), reserved_for and phone_number. The constructor should update the tables_reserved count.
Create a method called reservation_details that prints the data fields of a reservation.
The VipReservation class which extends the Reservation class and contains:
A data field named security_required which indicates whether security is required for that reservation.
A data field named requests which indicates the customers requests (e.g. partition, secluded table, specific waiters, special arrangements).
Create a constructor that takes three arguments: reserved_for, phone number and security_required
Create getter and setter methods (accessors and mutators) for all data fields.
A Main class to run your application from. In the main method of your Main class:
Create five Table objects. Two of these tables should be VIP tables.
Set Table details for each table using the setter methods
Print the table_count data field from the Table class to confirm you have 5 tables.
Print a message (or a sequence of messages) to prompt the user to enter their reservation type (vip or regular), reservation name and phone number. If the user chose VIP, ask if security is required. Use the entered name and phone number to create a reservation by calling the Reservation or VipReservation class constructor according to the users chosen reservation type.
If the user chose VIP, ask if they have special requests. Set the requests data field of the reservation to reflect the users entered requests.
Set the table data field in your reservation to one of the previously created tables.
Finally, print the reservation details by calling the reservation_details method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
