Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Assignment

Part 1: demonstrates inheritance.

Your Pizza Shop expands and now handles delivery orders and sit down orders in a restaurant setting. There are differences in a SeatedPizzaOrder and a DeliveryPizzaOrder. These are more specialized versions of the PizzaOrders you have been creating all along and you decide to write a program that handles them the same as much as possible and reuses the code of a general PizzaOrder class as much as possible to demonstrate inheritance.

Create a PizzaOrder Class. This class should have the following properties (and their underlying private variables): Size {of type int}, Toppings {of type String}, Price {of type Decimal}. Make a full constructor for the class that takes all three values, and a default constructor that initializes the basic pizza as a 12 inch cheese pizza for $8. Make sure to include validation in your Size and Price properties and constructor to prevent a change to Size that would be less than 12 or greater than 16, and prevent a change to Price that would be less than 0.

Create a class that inherits from your PizzaOrder class called SeatedPizzaOrder. SeatedPizzaOrder has the three data values that any PizzaOrder has (size, toppings, and price) but also has a tablenumber (of type integer) and serverName (of type string) which allows you to track where the pizza is going and who took the order in the restaurant

Create a class that inherits from your PizzaOrder class called DeliveryPizzaOrder. DeliveryPizzaOrder has the three data values that any PizzaOrder has (size, toppings, and price) but also has a driverName (of type string) which allows you to track who is delivering the pizza.

Create a GUI with controls of your choosing or a console class with a main in it. The choice is up to you to create objects of each and test them. This program should allow the user to enter in the values for a SeatedPizzaOrder and the values for a DeliveryPizzaOrder, and after creating an object of each one, it should displays their values (from the created objects) for the user.

_______ END PART 1 ________________________

PART 2

Part 2 is demonstrating polymorphism with classes of different types in an array being processed by a loop.

This program will demonstrate polymorphism and builds on your assignment 1 program. It will allow an array of PizzaOrders of both subclasses....and handle the bills for all of them to be paid all at once polymorphically.

Copy your PizzaOrder, SeatedPizzaOrder, and DeliveryPizzaOrder classes from PART1 into a new project for a C# application with a GUI.

Change your PizzaOrder from the PART 1 to be an abstract class. Make sure it has an abstract message called printBill().

Change your SeatedPizzaOrder class. Make sure it overrides the printBill() method to return a string with all of the information on the bill along with 10% added to the price.

Change your DeliveryPizzaOrder class. Make sure it overrides the printBill() method to return a string with all of the information on the bill along with $4 added to the price as a delivery fee.

Make a GUI program (with controls of your choosing) that has an array of 4 PizzaOrders in it. Include a checkbox (or radio buttons if you prefer) on the form to control whether it is a DeliveryPizzaOrder or not. Include all the screen controls needed to get the information from the user for either type of order and have a button to allow the user to add a PizzaOrder to the array of either type based on the users choice.

Finally, make sure the GUI include controls to allow the user to see the 4 PizzaOrders bills using printBill() polymorphically once they are all entered. Like a button to call it for the array in a loop, which takes the output from printBill() and adds it to a listbbox for each of them in turn as the loop calls it.

_______________END PART 2___________________

[Note: Using 4 orders because having exactly 4 means we can enter exactly the set number and prevent null reference exceptions and still use a loop with a counter. We could have a larger array and check for null values to see where there are no orders, or use an ArrayList or other collection in a real world setting. Having a set number simplifies this program and avoids the null reference error in testing..]

Java, Programming

  • Category:- Java
  • Reference No.:- M92020908
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Java

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Part a specification - robot simulationpart a

PART A Specification - Robot Simulation PART A Requirements To complete this assignment you will use the supplied eclipse project Robot P1/. It is already set up to execute a simple arm movement loop which you will build ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As