Repository navigation
Expand file tree
/
Copy pathTable.java
More file actions
84 lines (76 loc) · 2.26 KB
/
Copy pathTable.java
File metadata and controls
84 lines (76 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Purpose: Data Structure and Algorithms Project
* Status: Complete and thoroughly tested
* Last update: 04/18/18
* Submitted: 04/19/18
* Comment: test suite and sample run attached
* @author: Marcus Penate
* @version: 2018.02.01
*/
public class Table {
String name; //table name
int seatCount; //number of seats
CustomerParty party; //party currently seated at table
/**
*Constructor for table class
*@param name holds name of the table
*@param seatCount int which holds the number of seats available at a table
*/
public Table(String name, int seatCount) { //default full-filler constructor
this.name = name;
this.seatCount = seatCount;
party = null;
}
/**
*Method for getting name of a table
*@return returns the name of the table
*/
public String getName() {
return name;
}
/**
*Method for getting seatCount of a table
*@return returns the number of seats at a table
*/
public int getSeatCount() {
return seatCount;
}
/**
*Method to see if the a table has enough seats for requested amount
*@param requestedSeats number of seats that are needed
*@return returns boolean of whether the requested number <= nummber of seats available at the table
*/
public boolean canSeat(int requestedSeats) {
return (requestedSeats <= seatCount);
}
/**
*Adds a customerParty object to a table
*@param party customerParty object to be added to the table
*/
public void addParty(CustomerParty party) {
this.party = party;
}
/**
* Method for whether a table already has a customerParty object assigned to it
* @return returns if the table is already occupied by a party
*/
public boolean isTaken() {
return (party!=null);
}
/**
*Method to remove a party from a table
*@return returns party that has been removed from the table
*/
public CustomerParty removeParty() {
CustomerParty temp = party;
party = null;
return temp;
}
/**
*Method to peek at the CustomerParty currently occupying a table
*@return returns the party that is being served at the table
*/
public CustomerParty peekParty() {
return party;
}
}