Sale!

Project #2 Pizza Order.

$30.00

Category:
Rate this product

Introduction to Computer Science: Project #2 (50 points)

Write a Java program to perform the task of Pizza Order.

(1) First the program prompts user to enter the size choice.
//prompt user and get pizza size choice
System.out.println(“Pizza Size (inches) Cost”);
System.out.println(” 10 $10.99″);
System.out.println(” 12 $12.99″);
System.out.println(” 14 $14.99″);
System.out.println(” 16 $16.99″);
System.out.println(“What size pizza would you like?”);
If wrong size entered, an error message will be displayed and the user will be asked to reenter. The user has five chances to enter the right choice. After the 5th time, the program will terminate with a “very sorry” or similar message. Use a loop to deal with multiple times of selection.

(2) Then, the program prompts user to enter the crust choice. There are three types of crust available, hand-tossed, thin-crust, and deep-dish with deep-dish charging $2 extra, hand-tossed $1 extra. The user has up to three chances to enter the right choice. If wrong choice entered or the user doesn’t wish to enter a choice the default is thin-crust.

(3) Display the available topping choices as follows:
System.out.println(“All pizzas come with cheese.”);
System.out.println(“Additional toppings are $1.25 each,”
+ ” choose from”);
System.out.println(“Pepperoni, Sausage, Onion, Mushroom”);
The program will walk the user through each type of topping and ask user to enter ‘Y’ or ‘y’ for yes and ‘N’ or ‘n’ for no. For each type of topping, the user is given only one time of choice only. If wrong choice made, i.e. neither yes or no answer is given, it will be treated as no.

(4) Ask users to enter coupon code if any. Coupon codes are case insensitive and possible coupon codes are:

Coupon code Discount
Holiday10 10% off
Winter20 20% off
VIPmax 25% off

(5) Display the complete information of the user’s order as well as the final cost. The final cost should include 8.5% sales tax. Make sure the output for the dollar amount formatted properly.

(6) Ask the user if he/she wants to order additional pizza, if yes, repeat the above (1)-(5), if not, display the total cost for this order and a thank you message. Suggest to use a do-while loop to handle the order of multiple pizzas.

Testing requirements:
Test the program with the following test data:

Test 1: Enter size 15, 17, 11, 19, 21
Test 2: Enter size 17, 16
Enter a wrong crust, then choose thin-crust
Enter your choice of two toppings
No additional pizza wanted (i.e. 1 pizza for this order only)
Enter Winter20 coupon code
Test 3: Enter size 12
Choose deep-dish crust
Choose no toppings
Order an additional pizza, size 10, hand tossed, choose 3 toppings
Order an additional pizza, size 14, deep dish, choose 1 topping,
Enter no coupon code
Test 4: Enter size 16, thin crust, 1 topping with some wrong choices (i.e. neither yes nor no choices), no additional pizza, VIPmax coupon code
Test 5: Order two pizzas of your own choice

Submission requirements:
Create a script file that captures: program source code, all test runs for the program.
Submit two files: the script file as well as the source code file (.java file) on blackboard assignment under project 2.

Open chat
Need help?
Hello
Can we help you?