CIS 331讲解、辅导java Duke Dining Application
- 首页 >> Java编程CIS 331 – Spring 2019
HW #3 Duke Dining Application
Scenario: You will be writing a Java application that simulates a customer building a custom
Combo lunch plate in the JMU D-Hall.
Business Domain Knowledge:
Here are the prices that D-Hall charges for the various items on the Combo plate:
Sandwiches:
Veggie: $1.50
Chicken: $2.50
Beef: $2.00
Turkey: $1.80
A customer can have two side items on their plate. They choose two from this list:
Fries $0.50
Salad $0.70
Soup $1.50
Steamed Rice $0.40
Finally they can choose a drink:
Water: $0.20
Soft Drink: $1.70
Milk: $2.50
Berry Fizz: $1.20
D-Hall has several “Healthy” promotions going on:
If the customer selects the Chicken sandwich for lunch, they get a 20% discount on the
cost of their first side item.
If the customer chooses
o The Veggie sandwich, and
o Either the Soup or Rice for both sides (in any combination), and
o Water as their drink
They will then get a 30% discount on the entire order before taxes are calculated.
Your program should prompt the customer for each of the choices above (Sandwich, first Side,
second Side, and Drink), display a subtotal, display any discounts that apply to their order,
display the taxes, and then the total due at the end (See the example output below).
Requirements:
This is an individual homework assignment.
Your application should adhere to the above requirements, function as requested, and all
calculations should be correct.
Use .printf( ) to round all monetary amounts to 2 decimal places.
Include a comment header at the top of your .java file.
Comment sufficiently but not excessively.
Remember: The customer can select any of the four options for each and every food item.
There are many many different Combo plates that can be built with these!
Due: Wednesday, January 23rd by 11:59 p.m. Worth: 20 Homework Points
Example run and output:
Welcome to Duke Dining!
=======================
Build your Combo Plate:
Choose a Sandwich:
1: Veggie $1.50
2: Chicken $2.50
3: Beef $2.00
4: Turkey $1.80
-----------------
Selection?: 1
Choose your First Side:
1: Fries $.50
2: Salad $.70
3: Soup $1.50
4: Rice $.40
-----------------
Selection?: 3
Choose your Second Side:
1: Fries $.50
2: Salad $.70
3: Soup $1.50
4: Rice $.40
-----------------
Selection?: 4
Choose your Drink (Unlimited Refills):
1: Water $.20
2: Soft Drink $1.70
3: Milk $2.50
4: Berry Fizz $1.20
-----------------
Selection?: 1
===============
Receipt:
===============
Veggie $1.50
Soup $1.50
Rice $0.40
Water $0.20
===============
Subtotal: $3.60
30% Healthy Eating Discount Applied!
Taxes: $0.25
===============
Total Due: $2.77
===============