Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Stewart_ndungu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stewart.ndungu
Stewart_ndungu
Commits
85b1144e
Commit
85b1144e
authored
Dec 09, 2020
by
stewart.ndungu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
bbeb5b2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
265 additions
and
0 deletions
+265
-0
class1.java
class1.java
+265
-0
No files found.
class1.java
0 → 100644
View file @
85b1144e
package
class1
;
import
java.util.Scanner
;
import
java.util.ArrayList
;
import
java.util.*
;
public
class
class1
{
static
ArrayList
<
String
>
itemName
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
itemNume
=
new
ArrayList
<
String
>();
static
ArrayList
<
Integer
>
itemCode
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Integer
>
itemCude
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Float
>
itemPrice
=
new
ArrayList
<
Float
>();
static
ArrayList
<
Float
>
itemPruce
=
new
ArrayList
<
Float
>();
static
ArrayList
<
Integer
>
itemQty
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Integer
>
itemQyy
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
String
>
itemDescription
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
basketName
=
new
ArrayList
<
String
>();
static
ArrayList
<
String
>
basketNume
=
new
ArrayList
<
String
>();
static
ArrayList
<
Integer
>
basketCode
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Integer
>
basketCude
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Float
>
basketPrice
=
new
ArrayList
<
Float
>();
static
ArrayList
<
Float
>
basketPruce
=
new
ArrayList
<
Float
>();
static
ArrayList
<
Integer
>
basketQty
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
Integer
>
basketQyy
=
new
ArrayList
<
Integer
>();
static
ArrayList
<
String
>
basketDescription
=
new
ArrayList
<
String
>();
public
static
void
main
(
String
[]
args
)
{
// TODO Auto-generated method stub
itemName
.
add
(
"Pepperoni Pizza 12in"
);
itemPrice
.
add
((
float
)
9.99
);
itemCode
.
add
(
0
);
itemDescription
.
add
(
"This is our signature freshly made pizza. Pick from Pepperoni, Cheese, Vegetarian, or Deep Dish pizzas"
);
itemName
.
add
(
"Vegan Pizza 12in"
);
itemPrice
.
add
((
float
)
11.39
);
itemCode
.
add
(
1
);
itemDescription
.
add
(
"Our Vegetarian"
);
itemName
.
add
(
"Deep Dish Pizza 12in"
);
itemPrice
.
add
((
float
)
10.59
);
itemCode
.
add
(
2
);
itemDescription
.
add
(
"try our 2in thick pizza"
);
itemName
.
add
(
"Juicy Medium Rare Steak"
);
itemPrice
.
add
((
float
)
12.59
);
itemCode
.
add
(
3
);
itemDescription
.
add
(
"Try our juicy steak"
);
itemName
.
add
(
"Premium Veggie Burger"
);
itemPrice
.
add
((
float
)
15.99
);
itemCode
.
add
(
4
);
itemDescription
.
add
(
"Try our 100% plant based burgers"
);
itemNume
.
add
(
"Coke "
);
itemPruce
.
add
((
float
)
2.19
);
itemCude
.
add
(
0
);
itemNume
.
add
(
"Fanta "
);
itemPruce
.
add
((
float
)
2.19
);
itemCude
.
add
(
1
);
itemNume
.
add
(
"Water "
);
itemPruce
.
add
((
float
)
0.99
);
itemCude
.
add
(
2
);
itemNume
.
add
(
"Heineken 440 ML"
);
itemPruce
.
add
((
float
)
5.99
);
itemCude
.
add
(
3
);
itemNume
.
add
(
"Guiness 440 ML"
);
itemPruce
.
add
((
float
)
5.99
);
itemCude
.
add
(
4
);
Scanner
input
=
new
Scanner
(
System
.
in
);
String
Customer
,
Neme
,
Nume
;
int
num1
,
num2
,
answer
,
answer2
,
answer3
;
int
tempItemQty
,
tempItemCode
,
tempItemCude
,
tempItemQyy
;
float
Cust
,
Cost
,
boost
,
amount
,
SubTotal
;
//Asking the user their name
System
.
out
.
println
(
"Welcome to the LeNoir."
);
System
.
out
.
println
(
"What is your name?"
);
Customer
=
input
.
nextLine
();
//the board
System
.
out
.
println
(
Customer
+
", Please look and Choose a seat or seats (Space each individual number)"
);
String
board
[][]
=
{
{
"XX"
,
"01"
,
"02"
,
"XX"
,
"04"
,
"05"
,
"06"
},
{
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"XX"
,
"16"
},
{
"20"
,
"21"
,
"22"
,
"23"
,
"24"
,
"25"
,
"26"
},
{
"30"
,
"XX"
,
"32"
,
"XX"
,
"34"
,
"35"
,
"36"
},
{
"XX"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
},
{
"50"
,
"51"
,
"52"
,
"53"
,
"XX"
,
"55"
,
"XX"
}};
while
(
true
)
{
// displays the board
for
(
int
O
=
0
;
O
<
6
;
O
++)
{
for
(
int
K
=
0
;
K
<
7
;
K
++)
{
System
.
out
.
print
(
board
[
O
][
K
]
+
"|_|"
);
}
System
.
out
.
println
();
}
// user can enter the number
num1
=
input
.
nextInt
();
num2
=
input
.
nextInt
();
//decides if the seat is occupied or not. If not, the seat is occupied. If so, asks to choose another seat
if
((
board
[
num1
][
num2
])
!=
"XX"
)
{
board
[
num1
][
num2
]=
"XX"
;
System
.
out
.
println
(
"Thank you,"
+
Customer
+
". Please head to your seat."
);
//will display the board
System
.
out
.
println
(
"Here is the menu!"
);
System
.
out
.
println
();
System
.
out
.
println
(
"Menu: Price: Code:\tDescription\t"
);
for
(
int
N
=
0
;
N
<
itemName
.
size
();
N
++)
{
System
.
out
.
println
(
itemName
.
get
(
N
)
+
"\t"
+
itemPrice
.
get
(
N
)+
"\t"
+
itemCode
.
get
(
N
)
+
"\t:"
+
itemDescription
.
get
(
N
));
}
System
.
out
.
println
();
System
.
out
.
println
(
"Drinks: Price: Code"
);
for
(
int
P
=
0
;
P
<
itemNume
.
size
();
P
++)
{
System
.
out
.
println
(
itemNume
.
get
(
P
)+
"\t"
+
itemPruce
.
get
(
P
)+
"\t"
+
itemCude
.
get
(
P
));
}
// Asks the Customer their order
while
(
true
)
{
System
.
out
.
println
(
"What would you like to eat today! ( Enter the code for the food)"
);
tempItemCode
=
input
.
nextInt
();
System
.
out
.
println
(
"How many?"
);
tempItemQty
=
input
.
nextInt
();
basketCode
.
add
(
tempItemCode
);
basketName
.
add
(
itemName
.
get
(
tempItemCode
));
basketQty
.
add
(
tempItemQty
);
basketPrice
.
add
(
tempItemQty
*
itemPrice
.
get
(
tempItemCode
));
Cost
=
(
tempItemQty
*
itemPrice
.
get
(
tempItemCode
));
Neme
=(
itemName
.
get
(
tempItemCode
));
// displays their food
System
.
out
.
println
(
"Code\t:Name:\t\tPrice: Quantity"
);
for
(
int
U
=
0
;
U
<
basketName
.
size
();
U
++)
{
System
.
out
.
println
(
basketCode
.
get
(
U
)
+
"\t"
+
basketName
.
get
(
U
)
+
"\t:"
+
basketPrice
.
get
(
U
)
+
"\t"
+
"\t"
+
basketQty
.
get
(
U
));
}
System
.
out
.
println
(
"What to drink? (Enter the code for a drink"
);
tempItemCude
=
input
.
nextInt
();
System
.
out
.
println
(
"How many?"
);
tempItemQyy
=
input
.
nextInt
();
basketCude
.
add
(
tempItemCude
);
basketNume
.
add
(
itemNume
.
get
(
tempItemCude
));
basketQyy
.
add
(
tempItemQyy
);
basketPruce
.
add
(
tempItemQyy
*
itemPruce
.
get
(
tempItemCude
));
Cust
=
(
tempItemQyy
*
itemPruce
.
get
(
tempItemCude
));
Nume
=(
itemNume
.
get
(
tempItemCude
));
//displays their drinks
System
.
out
.
println
(
"Code\t:Name\t\tPrice: Quantity"
);
for
(
int
G
=
0
;
G
<
basketNume
.
size
();
G
++)
{
System
.
out
.
println
(
basketCude
.
get
(
G
)
+
"\t"
+
basketNume
.
get
(
G
)
+
"\t:"
+
basketPruce
.
get
(
G
)
+
"\t"
+
"\t"
+
basketQyy
.
get
(
G
));
}
boost
=
Cost
+
Cust
;
// Asks for confirmation. If not, it returns back to ask to their order
System
.
out
.
println
(
"is this the confirmed order? (Yes=3) (No=4)"
);
answer2
=
input
.
nextInt
();
while
(
answer2
==
3
)
{
//Adds their order and produces a receipt
System
.
out
.
println
(
"The true total price is"
+
"\t"
+(
boost
)+
"\t"
+
"For"
+
"\t"
+
Neme
+
"\t"
+
"&"
+
"\t"
+
Nume
);
System
.
out
.
println
(
"Please enter the payment amount"
);
amount
=
input
.
nextFloat
();
SubTotal
=
amount
-
boost
;
while
(
amount
>
boost
)
{
// checks if the payment was paid in full or not
System
.
out
.
println
(
"Your change is"
+
"\t"
+
SubTotal
);
System
.
out
.
println
();
System
.
out
.
println
(
"Your receipt"
);
System
.
out
.
println
(
"The Customer:"
+
Customer
);
System
.
out
.
println
(
"Seat #:"
+
num1
+
num2
);
System
.
out
.
println
(
Neme
+
"\t:"
+
Cost
);
System
.
out
.
println
(
Nume
+
"\t:"
+
Cust
);
System
.
out
.
println
(
"Total"
+
"\t"
+
boost
);
System
.
out
.
println
(
"Paid"
+
"\t"
+
amount
);
System
.
out
.
println
(
"Change"
+
"\t"
+
SubTotal
);
System
.
out
.
println
();
System
.
out
.
println
(
"Thank You for eating at LeNoir"
);
System
.
out
.
println
();
System
.
out
.
println
(
"Have a Nice day!"
);
return
;
}
if
(
amount
<
boost
){
System
.
out
.
println
(
"You are short in payment. Please pay in full!"
);
continue
;
}
return
;
}
if
(
answer2
==
4
)
{
//Returns back to asking for an order
continue
;
}
}
}
else
{
// Asks for another seat
System
.
out
.
println
(
"Sorry, that seat is not available. Please choose another seat."
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment