Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
Lab 5
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
9731050
Lab 5
Commits
8a30a4b9
Commit
8a30a4b9
authored
Apr 07, 2019
by
9731050
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2th
parent
d520b22e
Pipeline
#407
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
Order.java
src/com/restaurant/Order.java
+6
-4
Restaurant.java
src/com/restaurant/Restaurant.java
+2
-1
No files found.
src/com/restaurant/Order.java
View file @
8a30a4b9
...
@@ -4,7 +4,7 @@ public class Order {
...
@@ -4,7 +4,7 @@ public class Order {
private
int
id
;
private
int
id
;
private
Customer
customer
;
private
Customer
customer
;
private
Food
[]
foods
;
private
Food
[]
foods
;
private
int
price
;
private
double
price
;
public
Order
(
int
id
,
Customer
customer
,
Food
[]
foods
)
{
public
Order
(
int
id
,
Customer
customer
,
Food
[]
foods
)
{
this
.
id
=
id
;
this
.
id
=
id
;
...
@@ -13,10 +13,8 @@ public class Order {
...
@@ -13,10 +13,8 @@ public class Order {
for
(
Food
food
:
foods
)
{
for
(
Food
food
:
foods
)
{
price
+=
food
.
getPrice
();
price
+=
food
.
getPrice
();
System
.
out
.
println
(
"price="
+
price
);
}
}
price
*=
1.4
;
price
*=
1.4
;
System
.
out
.
println
(
"price2="
+
price
);
customer
.
setOrder
(
this
);
customer
.
setOrder
(
this
);
}
}
...
@@ -24,7 +22,7 @@ public class Order {
...
@@ -24,7 +22,7 @@ public class Order {
return
foods
;
return
foods
;
}
}
public
int
getPrice
()
{
public
double
getPrice
()
{
return
price
;
return
price
;
}
}
...
@@ -35,8 +33,12 @@ public class Order {
...
@@ -35,8 +33,12 @@ public class Order {
}
}
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
for
(
int
i
=
0
;
i
<
amount
;
i
++)
{
temp
[
foods
.
length
+
i
]
=
food
;
temp
[
foods
.
length
+
i
]
=
food
;
// System.out.println("s="+price);
// System.out.println("f="+getPrice());
price
=
price
+(
temp
[
foods
.
length
+
i
].
getPrice
())*
1.4
;
}
}
foods
=
temp
;
foods
=
temp
;
temp
=
null
;
temp
=
null
;
}
}
...
...
src/com/restaurant/Restaurant.java
View file @
8a30a4b9
...
@@ -82,8 +82,9 @@ public class Restaurant {
...
@@ -82,8 +82,9 @@ public class Restaurant {
}
}
public
void
acceptPayment
(
Customer
customer
)
{
public
void
acceptPayment
(
Customer
customer
)
{
int
menuCost
=
customer
.
getOrder
().
getPrice
();
double
menuCost
=
customer
.
getOrder
().
getPrice
();
currentCustomers
.
remove
(
customer
);
currentCustomers
.
remove
(
customer
);
fund
+=
menuCost
*
0.9
;
fund
+=
menuCost
*
0.9
;
totalNumOfFood
+=
customer
.
getOrder
().
getFoods
().
length
;
totalNumOfFood
+=
customer
.
getOrder
().
getFoods
().
length
;
}
}
...
...
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