Description
Faculty of Engineering and Information Technology
Computer Science Department
Comp 2310 Project Phase I
Write a complete Java program that creates the following classes:
o pizzaSize (final static int SMALL=1, MEDIUM=2, LARGE=3) o numberOfToppings ( int ) o toppingPrice ( double )
o Appropriate constructors ( default and non default ) as well as the appropriate setter and getter methods.
o A toString( ) method. o Method calculateOrderPrice() which calculates the price of the pizza order as follows:
( numberOfToppings * toppingPrice ) * pizzaSize o Method printOrderInfo () which prints only the customer’s name and the calculated order price on one line to the screen.
2- class Delivery which extends PizzaOrder and contains the following attribute and methods: o tripRate ( double ) o zone ( int 1-4)
o Appropriate constructors ( default and non default ) as well as the appropriate setter and getter methods.
o toString() method that overrides the method in PizzaOrder.
o A calculateOrderPrice() method which overrides the method in PizzaOrder and adds the ( tripRate/100 * totalprice * zone ) to the price.
3- class ToGo which extends PizzaOrder.
4- Class Seated which extends PizzaOrder and contains the following attribute and methods: o serviceCharge ( double ) o numberOfPeople ( int ) o toString() method that overrides the method in PizzaOrder.
o A calculateOrderPrice() method which overrides the method in PizzaOrder and adds the ( serviceCharge * numberOfPeople ) to the price. 5- A Driver class which includes the following methods:
1
o main method that does the following:
– creates an ArrayList called orders of type PizzaOrder and adds five different orders to it ( two Delivery, one ToGo, and two Seated ).
You must NOT ask the user to enter the attributes but you should fill them up directly in the main method. MAKE SURE YOUR CONSTRUCTORS FOLLOW THE SAME ORDER OF ATTRIBUTES AS SPECIFIED ABOVE AS FOLLOWS:
PizzaOrder (customerName, pizzaSize, numberOfToppings, toppingPrice)
Delivery (customerName, pizzaSize, numberOfToppings, toppingPrice, tripRate, zone)
ToGo (customerName, pizzaSize, numberOfToppings, toppingPrice)
Seated (customerName, pizzaSize, numberOfToppings, toppingPrice, serviceCharge, numberOfPeople)
Asking the user to enter the attributes or not following the constructor order as above will result in your assignment not getting graded and you will receive a zero grade.
– Sorts the orders based on their calculated order price.
– Prints the sorted orders customer names and prices.
– Prints the total sum of all order prices.
– Prints a report ( all properties and order price ) for the second Delivery order ( orders.get(1) ).
o Method calculateTotalOrdersPrice which takes an ArrayList of type PizzaOrder as an argument and returns the total price of all the orders in that ArrayList.
Please note the Following:
1. Your program should be well commented based on Java formal documentation.
What you need to turn in:
1- Your project folder ( containing all your project .java files) should be compressed (.rar) and saved as proj_I_youridnumber_yourLabsectionnumber.rar ( for example if your student id number is 1211234 and your lab section is section 9 then the project folder should be called proj_I_1211234_s9.rar ). Turn in your project by replying to the course coordinator’s message on Ritaj and attaching your code .rar file (proj_I_youridnumber_yourLabsection.rar).
2- You must include your full name, student id number, and lab section number in a comment at the beginning of each of your class code files.
Late Projects (even one minute late) will NOT be accepted for any reason.
2
Reviews
There are no reviews yet.