-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSupermarket.java
More file actions
40 lines (31 loc) · 1.16 KB
/
Supermarket.java
File metadata and controls
40 lines (31 loc) · 1.16 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
public class Supermarket{
public static void main(String[] args){
Person personBegin = new Person(0);
Person firstPerson = new Person(15);
Person secondPerson = new Person(13);
Person thirdPerson = new Person(12);
Person fourthPerson = new Person(19);
Person fifthPerson = new Person(43);
Person sixthPerson = new Person(39);
Person seventhPerson = new Person(11);
personBegin.addPerson(firstPerson);
personBegin.addPerson(secondPerson);
personBegin.addPerson(thirdPerson);
personBegin.addPerson(fourthPerson);
personBegin.addPerson(fifthPerson);
personBegin.addPerson(sixthPerson);
personBegin.addPerson(seventhPerson);
personBegin = firstPerson;
System.out.print("There are " + personBegin.getQueueSize());
System.out.println(" people in the queue.");
personBegin.servePerson();
personBegin.servePerson();
personBegin.servePerson();
while(personBegin != null){
System.out.println(personBegin.getItems());
personBegin = personBegin.getNext();
}
System.out.print("There are " + personBegin.getQueueSize());
System.out.println(" people in the queue.");
}
}