Package Tables

Class Table

java.lang.Object
Tables.Table

public class Table extends Object
This class represents a table in a restaurant with information about the table's number, seats, dishes, and bill.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Table(int tableNumber)
    Constructs a new table object with a table number
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 seat
    int
    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 table
    Returns a string representation of the dishes at the table.
    double
    Returns the total bill due for the table.
    boolean
    isSeatEmpty(int seat)
    Boolean method to check if a seat is empty

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 number
      dishNumber - 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

      public String getTableDishes()
      Returns a string representation of the dishes at the table.
      Returns:
      returns a list of dishes ordered at the table
    • getSeatDishes

      public String getSeatDishes(int seat)
      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