COSC 1010 (Summer 2014) Assignment III Due by Wednesday, July 30, 2014 11:59 PM
ID: 3560004 • Letter: C
Question
COSC 1010 (Summer 2014)
Assignment III
Due by Wednesday, July 30, 2014 11:59 PM CST
Pizza Shop
In this assignment, you will create classes named Pizza, PizzaOrder and PizzaStore.
Part A
Create a class named Pizza that stores information about a single pizza. It should contain the following:
Pizza cost is determined by
Small: $10 + $2 per topping + $1 for extra sauce
Medium: $12 + $2 per topping + $1 for extra sauce
Large: $14 + $2 per topping + $1 for extra sauce
Part B
Create a class named PizzaOrder that allows up to three pizzas to be saved in an order. Each pizza must be a Pizza object as described in Part A. Your class should have private instance variables for three pizza objects, number of pizzas in the order, any other relevant instance variables, and getter/setter methods. Some of these methods are described below.
Also, implement a method named calcTotal() that returns the total cost of the order.
Part C
Create a class named PizzaStore with a main method. The class will prompt user to create a pizza order.
The program will ask how many pizzas to order, which could be between 1 and 3. Then user will be prompted about the size, number of toppings of each pizza and whether each pizza will have extra sauce or not.
Then, the program will print the description of each pizza and the total cost of the order. Your program will prompt the same question again if the user enters an invalid value (e.g., entering 5 for number of pizzas to order, entering -2 for number of toppings, etc.).
Finally, user will be asked to make a new order. If user types 'y' or 'Y', the user will be prompted for the questions again.
A sample dialogue is shown below (user prompts, user input, output). Make sure to make your program prompt and output are same as in the example.
Welcome to our Pizza store.
How many pizza to order: 2
Size of pizza 1 (1: small, 2: medium, 3: large): 1
Number of toppings for pizza 1: 2
Extra sauce for pizza 1: false
Size of pizza 2 (1: small, 2: medium, 3: large): 5
Invalid value. Size of pizza 2 (1: small, 2: medium, 3: large): 2
Number of toppings for pizza 2: 3
Extra sauce for pizza 2: true
Summary of your order:
Pizza 1: Small pizza with 2 toppings without extra sauce. Cost: $14
Pizza 2: Medium pizza with 3 toppings with extra sauce. Cost: $19
Total cost: $33
Thank you for your order. Press y/Y to make another order, any other key to exit: q
Goodbye!
Notes:
Guidelines: Write your code in clean, understandable, and well-organized format. Follow a consistent indentation, use whitespace properly, and give meaningful variable names. Use constants whenever appropriate. Make sure that your code is well documented with proper comments. Do not overly comment your code by adding comment for everywhere. Follow all the style & documentation guidelines described in the book and discussed at the class. The detailed grading rubric is given on the next page.
No errors, program always works correctly and meets the specification(s).
Minor details of the program specification are violated, program functions incorrectly for some inputs.
Up to two missing minor specifications among
Significant details of the specification are violated, program often exhibits incorrect behavior.
More specifically, the program has up to three minor specifications missing described in previous criteria or one major error such as:
Significant details of the specification are violated, program often exhibits incorrect behavior.
Four or more minor errors or up to two major errors.
Program only functions correctly in very limited cases or not at all.
No errors, code is clean, understandable, and well-organized.
The name of the folder submitted to D2L does not meet the specified format.
Minor issues with consistent indentation, use of whitespace, variable naming, or general organization.
At least one major issue with indentation, whitespace, variable names, or organization.
Major problems with at three or four of the readability subcategories.
No errors, code is well-commented.
One comment is missing that would have benifited from the comment.
Two or more places that could benefit from comments are missing them or the code is overly commented.
File header missing, complicated lines or sections of code uncommented or lacking meaningful comments.
Javadoc documentation is missing.
No file header or comments present.
No errors, code uses the best approach in every case.
Very minor defect in code efficiency.
N/A
Code uses poorly-chosen approaches in at least one place.
Many things in the code could have been accomplished in an easier, faster, or otherwise better fashion.
Welcome to our Pizza store.
How many pizza to order: 2
Size of pizza 1 (1: small, 2: medium, 3: large): 1
Number of toppings for pizza 1: 2
Extra sauce for pizza 1: false
Size of pizza 2 (1: small, 2: medium, 3: large): 5
Invalid value. Size of pizza 2 (1: small, 2: medium, 3: large): 2
Number of toppings for pizza 2: 3
Extra sauce for pizza 2: true
Summary of your order:
Pizza 1: Small pizza with 2 toppings without extra sauce. Cost: $14
Pizza 2: Medium pizza with 3 toppings with extra sauce. Cost: $19
Total cost: $33
Thank you for your order. Press y/Y to make another order, any other key to exit: q
Goodbye!
Explanation / Answer
}
import javax.swing.*;Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.