Assignment 1 Task (ITECH2306) ( Page 2 of 3 ) Overview Assessment task: Assignment 1 You will write a small Java program consisting of a few classes, in order to demonstrate your understanding of...

1 answer below »
Assignment 1 Task (ITECH2306)
(
Page
2
of 3
)
Overview
Assessment task: Assignment 1
You will write a small Java program consisting of a few classes, in order to demonstrate your understanding of topics from weeks 1 to 5.
This is an individual assignment. The work must be your own work.
Timelines and Expectations
Percentage Value of Task:10%
Minimum time expectation:2 hours
Maximum time expectation:8 hours
Assessment Details / Tasks
The Pizza Place is a chain of take-away food outlets that make pizzas. They are wanting you to write a program for them that lets them calculate the price of pizzas where the customer decides what toppings they want.
Coding Requirements and Contextual Information:
You need to make a class named Pizza which requires a constructor that specifies the size (either small, medium or large), and the type of crust (either thin or thick). The selections specified here help to determine the price that is charged as follows: Thick-crust pizzas cost $2.20 extra compared to thin-crust pizzas (regardless of size), and the base cost of a pizza is determined by its size, then by what toppings are added. The small is $5.50, the medium is $9.10, the large is $13.70.
A pizza can have up to 8 toppings but no more. The class must enforce the following limits:
One of these toppings can be a sauce. A Tomato-paste sauce costs $1.00, but a barbeque-flavoured sauce costs $1.80.
Up to 3 toppings can be a type of meat/seafood. The options are:
ham $0.50salami $0.50bacon $0.90chicken $2.00shrimp $1.40 The remaining items available as toppings are the following:
capsicum $0.30onion $0.20tomatoes $0.40mushrooms $0.45pineapple $0.45
egg $0.25olives $0.35garlic $0.30cheese 0.20pumpkin $0.50
The Pizza class must provide a toString() method which returns a String describing the pizza by stating firstly the type of base and the size, then the toppings that are included, and then the price of the pizza. For example the following two are possible combinations:
Small Thin-Crust pizza, with tomato-paste sauce, ham, salami, capsicum, mushrooms, pineapple, cheese, price: $7.90
Large Thick-Crust pizza, with barbeque sauce, chicken, capsicum, tomatoes, mushrooms, olives, pumpkin, cheese, price: $20.10
You also should create a class named Topping which can be used to represent the information about each of the available toppings. In addition to the constructor, there should be getters and setters for the information about the topping.
It is adequate (for this assignment), for the Topping class to be used just for obtaining information about particular toppings – there is no requirement to link the Topping objects to the Pizza (but you can if you choose to and feel confident about it). An adequate approach in the Pizza class is to use accumulation,
e.g. you could use a StringBuilder or StringBuffer, and you could gradually increase a price tally, to work towards the final information.
Behavioural Requirements of program:
In addition to the coding requirements described above, your program needs to achieve the following behavioural aspects:
1. The program must present a welcome to the user.
2. The program must let the user make a selection of what type of pizza crust and what size they want the pizza to be. The user should be presented with a list of the possible options, for making a selection from the list.
3. The program must present the various toppings that are available (in whatever manner you feel appropriate), and the user must be able to indicate their selections.
4. The user must be able to indicate when they have finished making their selections. At this point, the toString method should be called to show the details of the pizza to the user.
5. The program should allow the user to be able to specify at least 3 pizzas without the program ending.
Additional requirements of the assignment:
1. You should have at least 3 classes: the Pizza class, the Topping class, and the class containing the main program.
2. You should try to create another class which contains several JUnit tests, so that every method of the Pizza class is tested at least once for correct expected behaviour (a ‘pass’ test), and also so that there are overall at least 2 ‘no-pass’ tests (tests which are expected to fail in some way).
Submission Requirements & Implications of Missed Deadlines
You need to use WinZip or similar, to gather all the source code files and other contents of your Eclipse Project (or other IDE’s files) into a single file, which you submit onto Moodle. Most important are the .java files, as these contain your code. A zip file lets you store a complete directory structure (including subdirectories/sub-folders) – in Windows, right-click on the folder containing your project and select “Send to” > “Compressed (zipped) folder”.
Before you can submit, you will have to accept the declaration of originality.
You must also click the “Send for marking” button before the due date, to finalise your submission.
Late submissions will have a penalty of 10% of the available marks for that stage, deducted for each day (or part of day) that it is late. For example, if you submit 30 hours late, this is more than 1 day but less than 2 days, so a penalty of 20% of 20 (i.e. 4), will be deducted from what your work is worth. If you have a legitimate reason why you won’t be able to submit on time, you must request an extension from your lecturer in advance of the due date, by submitting the relevant documentation.
After the cut-off date, you will have accumulated a 100% penalty, and the most you would get is 0.
Marking Criteria
The work will be marked according to the following scheme:
Criteria
Available Marks
Ability to create appropriate constructors for custom-made classes
2 marks
Ability to invoke constructors appropriately (to make objects)
1 mark
Ability to write code involving decision/selection constructs
2 marks
Ability to write code involving repetition constructs
1 mark
Ability to form appropriate logical and relational expressions
1 mark
Ability to appropriately use variables and fields in coding
2 marks
Ability to write sequences of code to perform processing
2 marks
Ability to use other programming constructs (e.g. arrays, classes from the Java API) appropriately
1.5 marks
Appropriateness of the structuring of the project’s files (source code, and other project files)
1 mark
Ability to write test cases in JUnit
1.5 marks
Behavioural Requirement 1 is achieved appropriately and correctly
0.5 marks
Behavioural Requirement 2 is achieved appropriately and correctly
1 mark
Behavioural Requirement 3 is achieved appropriately and correctly
2 marks
Behavioural Requirement 4 is achieved appropriately and correctly
1 mark
Behavioural Requirement 5 is achieved appropriately and correctly
0.5 marks
TOTAL:
20 marks
The total mark out of 20, will be scaled to a value out of 10 to contribute 10% to the final course mark.
Answered Same DayMay 16, 2021

Solution

Kshitij answered on May 16 2021
32 Votes

Pizza.java
Pizza.java
/*   Created by IntelliJ IDEA.
 *   Author: Kshitij Varshney (kshitijvarshne1)
 *   Date: 16-May-21
 *   Time: 5:11 PM
 *   File: Pizza.java
 */
p...

Submit New Assignment

Copy and Paste Your Assignment Here