Package Tables
Class Table
java.lang.Object
Tables.Table
This class represents a table in a restaurant with information
about the table's number, seats, dishes, and bill.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDish
(int seat, int dishNumber) Adds a dish to the table at the given seat.void
clearSeat
(int seat) clears the dishes at a given seatint
Returns the table number.getSeatDishes
(int seat) Returns a string representation of the dishes at a seat.int
Returned the number of seats filled at a tableReturns a string representation of the dishes at the table.double
getTotal()
Returns the total bill due for the table.boolean
isSeatEmpty
(int seat) Boolean method to check if a seat is empty
-
Constructor Details
-
Table
public Table(int tableNumber) Constructs a new table object with a table number- Parameters:
tableNumber
- the table number
-
-
Method Details
-
getNumber
public int getNumber()Returns the table number.- Returns:
- the table number
-
addDish
public void addDish(int seat, int dishNumber) Adds a dish to the table at the given seat.- Parameters:
seat
- the seat numberdishNumber
- the name of the dish
-
clearSeat
public void clearSeat(int seat) clears the dishes at a given seat- Parameters:
seat
- the seat number
-
isSeatEmpty
public boolean isSeatEmpty(int seat) Boolean method to check if a seat is empty- Parameters:
seat
- the seat number- Returns:
- returns true if the seat is empty
-
getTableDishes
Returns a string representation of the dishes at the table.- Returns:
- returns a list of dishes ordered at the table
-
getSeatDishes
Returns a string representation of the dishes at a seat.- Parameters:
seat
- the seat number- Returns:
- returns a list of dishes ordered at the seat
-
getSeatsFilled
public int getSeatsFilled()Returned the number of seats filled at a table- Returns:
- the number of seats filled
-
getTotal
public double getTotal()Returns the total bill due for the table.- Returns:
- the total bill for the table
-