-
Notifications
You must be signed in to change notification settings - Fork 1
/
Restaurant.java
151 lines (129 loc) · 3.68 KB
/
Restaurant.java
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import java.util.Scanner;
public class Restaurant implements Date{
private String address;
private String phone ;
private double rating;
private int customer_counter = 0;
private int table_counter = 0;
private int order_counter = 0;
private int menu_counter = 0;
Scanner scn = new Scanner(System.in);
Customer [] customer = new Customer[100];
Table [] table = new Table[100];
Order [] order = new Order[100];
private Menu[] menu = new Menu[100];
public Restaurant()
{
address = "Serdivan";
phone = "2641317";
rating = 4.4;
//dateOfTheEvent(1996,07,17);
Boss boss = new Boss("Ezgi Berfin","ÞAHÝN",53);
while(true)
{
System.out.print("Choose your operation = ");
String operation = scn.nextLine();
if(operation.equals("Add Customer"))
{
System.out.print("Name of the customer = ");
String name = scn.nextLine();
System.out.print("Surname of the customer = ");
String surname = scn.nextLine();
System.out.print("Quantity of order = ");
int quantity = scn.nextInt();
addCustomer(name,surname);
displayCustomer();
addOrder(new Customer(name,surname,customer_counter),quantity);
displayOrder();
}
else if(operation.equals("Add Table"))
{
System.out.print("Number of seats = ");
int seatnum = scn.nextInt();
addTable(seatnum);
displayTables();
}
else if(operation.equals("Add Cashier") || operation.equals("Add Chef") || operation.equals("Add Waitress"))
{
System.out.print("Type of the worker = ");
String worker = scn.nextLine();
boss.hireStaff(worker);
}
else if(operation.equals("Add Food"))
{
System.out.print("Title of the food = ");
String title = scn.nextLine();
System.out.print("Description of the food = ");
String description = scn.nextLine();
System.out.print("Price of the food = ");
double price = scn.nextDouble();
System.out.println("Chef name = ");
String name = scn.next();
System.out.println("Chef surname = ");
String surname = scn.next();
addMenu(new Chef(name,surname,menu_counter),title, description, price);
displayMenu();
}
}
}
@Override
public String toString() {
return "Restaurant [address=" + address + ", phone=" + phone + ", rating=" + rating + "]";
}
public void addCustomer(String name, String surname)
{
customer[customer_counter] = new Customer( name, surname, customer_counter);
customer_counter++;
}
public void displayCustomer()
{
for(int i = 0;i<customer_counter;i++)
{
System.out.println(customer[i].getName() + customer[i].getSurname() + customer[i].getId());
}
}
public void addTable(int numberofSeats)
{
table[table_counter] = new Table(table_counter,numberofSeats);
table[table_counter].setFilled(true);
table_counter++;
}
public void displayTables()
{
for(int i = 0;i<table_counter;i++)
{
System.out.println(table[i].toString());
}
}
public void addOrder(Customer c,int orderQuantity)
{
order[order_counter] = new Order(order_counter,orderQuantity);
order[order_counter].setCustomer(c);
order_counter++;
}
public void displayOrder()
{
for(int i=0;i<order_counter;i++)
{
System.out.print(order[i].toString());
System.out.println();
}
}
public void addMenu(Chef chef,String title,String description, double price)
{
menu[menu_counter] = new Menu(title,description,price);
menu[menu_counter].setChef(chef);
menu_counter++;
}
public void displayMenu()
{
for(int i=0;i<menu_counter;i++)
{
System.out.print(menu[i].toString());
}
}
@Override
public void dateOfTheEvent(int year, int month, int day) {
System.out.print("Date of foundation = " + day + "." + month + "." + year);
}
}