Class Tables.TableData
java.lang.Object
Employee.EmployeeData
Tables.TableData
Tables.TableData class represents the data for restaurant tables, including table number,
number of seats, number of seats filled, and dishes ordered.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Tables.TableData object with 20 tables initialized with a Tables.Table object for each table. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a dish to the order at the specified seat at the specified table.getDishes
(int tableNumber) Returns a string containing the dishes ordered at the specified table.int
getEmptySeats
(int tableNumber) Returns the number of empty seats at the specified table.int
getFilledSeats
(int tableNumber) Returns the number of filled seats at the specified table.getTableData
(int tableNumber) Returns the data for a specified table as a formatted string.boolean
isFilled
(int tableNumber) Returns true if the specified table has 4 or more seats filled, false otherwise.Returns a formatted string with data for all tables in the table data.void
setSeatsFilled
(int tableNumber, int seatsFilled) Sets the number of seats filled for the specified table.Methods inherited from class Employee.EmployeeData
addEmployee, addScheduleOptions, editEmployee, employeeRestore, getScheduleOptions, isEmployee, listEmployee, listSection, remEmployee, remScheduleOptions, searchEmployee
-
Constructor Details
-
Tables.TableData
public Tables.TableData()Creates a new Tables.TableData object with 20 tables initialized with a Tables.Table object for each table.
-
-
Method Details
-
getTableData
Returns the data for a specified table as a formatted string.- Parameters:
tableNumber
- the number of the table to get data for- Returns:
- a string with the table number, seats filled, and dishes ordered
- Throws:
RuntimeException
- if the specified table number is not found in the table data
-
listTables
Returns a formatted string with data for all tables in the table data.- Returns:
- a string with the table number, seats filled, and dishes ordered for all tables
-
isFilled
public boolean isFilled(int tableNumber) Returns true if the specified table has 4 or more seats filled, false otherwise.- Parameters:
tableNumber
- the number of the table to check for filling- Returns:
- true if the specified table is filled, false otherwise
- Throws:
RuntimeException
- if the specified table number is not found in the table data
-
setSeatsFilled
public void setSeatsFilled(int tableNumber, int seatsFilled) Sets the number of seats filled for the specified table.- Parameters:
tableNumber
- the number of the table to set seats filled forseatsFilled
- the number of seats filled to set for the table- Throws:
RuntimeException
- if the specified table number is not found in the table data
-
getEmptySeats
public int getEmptySeats(int tableNumber) Returns the number of empty seats at the specified table.- Parameters:
tableNumber
- the number of the table- Returns:
- the number of empty seats
- Throws:
RuntimeException
- if the table does not exist
-
getFilledSeats
public int getFilledSeats(int tableNumber) Returns the number of filled seats at the specified table.- Parameters:
tableNumber
- the number of the table- Returns:
- the number of filled seats
- Throws:
RuntimeException
- if the table does not exist
-
getDishes
Returns a string containing the dishes ordered at the specified table.- Parameters:
tableNumber
- the number of the table- Returns:
- a string containing the dishes ordered
- Throws:
RuntimeException
- if the table does not exist
-
addDish
Adds a dish to the order at the specified seat at the specified table.- Parameters:
tableNumber
- the number of the tableseatNumber
- the number of the seatdish
- the name of the dish- Throws:
RuntimeException
- if the table does not exist
-