Create a class that inherits from your pizzaorder class

Assignment Help JAVA Programming
Reference no: EM131266155

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..]

Reference no: EM131266155

Questions Cloud

Develop an er diagram for the given scenario : In this assignment, you will develop an ER diagram for the given scenario. To complete this assignment, you will need MySQL Workbench. MySQL Workbench is available for free download at www.mysql.com under Downloads (GA) tab.
Determine the power output and the type of turbine : Determine the power output, the type of turbine, and the approximate speed for the installation shown in Fig. P12.40. Neglect all minor losses except those existing at the valve.
Provide an overview of three major health issues prevalent : Provide an overview of the three major health issues prevalent in the United States you chose to present. Choose one of those health issues and address the following: Risk factors for that issue and Possible prevention of the issue.
Company market segment assignment : Submit the Company's Market Segment assignment. In this assignment, you must identify, describe, and thoroughly analyze the market segments your company has chosen to compete in and support of the coca-cola company.
Create a class that inherits from your pizzaorder class : 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.
Find the symmetric nash equilibrium : In a Tragedy of the Commons scenario, the commons production function is F(X)= 1.6X - 0.2X^2. The rate of return outside the commons remains 0.1. Find the symmetric Nash Equilibrium when there are seven players. Is your solution tragic?
Write a brief description of your project proposal : Write a brief description of your project proposal that describes the task to be scripted. Explain how it meets the requirements for a task that should be scripted.
Calculate joe total and average cost curves : Calculate Joe's total and average cost curves (as a function of q)
What is predictive data analytics : How do machine learning algorithms deal with the fact that machine learning is an ill-posed problem?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Demonstrate your object-oriented programming skills

Demonstrate your object-oriented programming skills by creating a program involving multiple classes.

  Write a loop that will print out the value

Given the subsequent code segment that reads in a String str - Write a loop that will print out the value entered into str in reverse.

  Write a recursive method to print all permutations of string

Write a recursive method to print all the permutations of a string. For instance, for a string abc, the printout is: abc acb bac bca cab cba

  Prompts user to enter 7 elements

Write a java application that prompts user to enter 7 elements. The elements will be stored in an array list of type double.  All elements entered should then be displayed on a separate line. The sum of the elements should also be shown in the end li..

  Prepare a polynomial-time algorithm

Write a polynomial-time algorithm that, given an initial configuration (P_1, P_2, ..., P_k), decides if it is a winning configuration - Prepare a polynomial-time algorithm that decides if it is a winning configuration.

  Design and implement a small and simple email server using

design and implement a small and simple email server using the concept of web based information system wbis. your

  In a method named setfavoritesports declare

In a method named setFavoriteSports declare the sports array and populate it.  This method will return the sports array to the calling statement.  The 9 in the prompt below will print 1 for the first sport, then 2 for the 2nd one and so forth.  Use t..

  Import javaioimportjavautilscannernbspnbsp year3000

import java.io.importjava.util.scannernbspnbsp year3000 programnbspnbsp driver program for the dateinterface and mydate

  Write servlet code for accepting two numbers from user

Write the servlet code for accepting two numbers from user show addition and multiplication of numbers. If error occurs, then call JSP error page to display suitable error message.

  How are exceptions caught

How are exceptions caught? When should Exception Handling be used

  Analyze a task and describe it succinctly

Programming the Familiar Good programmers are able to analyze a task and describe it succinctly, accurately, and unambiguously. Even tasks that you perform without much thought are surprisingly complex when you stop and consider all of their compo..

  Techniques used to secure web servers

Two of the most popular web servers are Apache and Microsoft IIS. Discuss some of the tools and techniques used to secure these web servers.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd