Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment Three

You will create a class named Pizza that stores information for a single pizza. The class should include the following:

1) Private field variables that will store the size of the pizza (small, medium, or large), the number of cheese toppings, the number of pepperoni toppings, and the number of mushroom toppings.

2) A constructor that initializes all of the variables.

3) Public methods to get and set the field variables.

4) A public method named calculateCost() that returns a double value with the cost of the pizza.

Pizza cost is determined by:
Small: $10 + $2 per topping
Medium: $12 + $2 per topping
Large: $14 + $2 per topping

Cost should be printed out with the $ and two decimal places.

5) A public method named getDescription() which outputs a description to the screen with the pizza size, quantity of each topping, and the total cost which is called by calculateCost()

You will also create a class called PizzaOrder which will have a main method to create your pizzas. In this main method,

1) You will ask the user to input a pizza size and number of toppings for cheese, pepperoni, and mushroom. Use the constructor to set these values.

2) Print out the description to the screen with getDescription().

3) Restrictions on the input in PizzaOrder: there can be a max of double toppings for cheese, and a max of triple toppings for pepperoni and/or mushroom. Minimum values are zero. You will need to check to make sure the user is entering proper values for the toppings. If they enter an invalid answer, prompt one more time. If they enter an invalid answer a second time, cancel the order and end the program.

Remember to write a program description in comments for your program. You do not need to create a variable dictionary unless you are using variables that are not obviously labelled.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92789943

Have any Question?


Related Questions in Computer Engineering

A swimmer is an athlete any athlete who participated in the

A swimmer is an athlete. Any athlete, who participated in the 2016 Summer Olympics and won a gold medal, was joyful. Any athlete, who is the world top athlete or a selected well-trained athlete, participated in the 2016 ...

A study sample was done regarding the association between

A study sample was done regarding the association between family history and the risk of developing AD. Exposure were family history of AD and no family history of AD. Outcomes were development of AD or no development of ...

Why does some workers earn higher wages than others some

Why does some workers earn higher wages than others, some landowners higher rental income than others, and some capital owners greater profit than others? (Example)Why, in particular, do computer programmers earn more th ...

Question suppose that a disk drive has 5000 cylinders

Question : Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4, 999. The drive is currently serving a request at cylinder 2, 150, and the previous request was at cylinder 1, 805. The queue of pending requests, ...

Question provide a real-world example or describe a

Question: Provide a real-world example or describe a hypothetical situation in which a legitimate organization used spam in an effective and nonintrusive manner to promote a product or service. Need 300-350 words APA sta ...

Under the trade model with external economies of scale is

Under the trade model with external economies of scale, is it possible for a country to be worse off with trade than it would have been without trade? Justify your answer.

Suppose that we have a block cipher and want to use it as a

Suppose that we have a block cipher and want to use it as a hash function. Let X be a specified constant and let M be a message consisting of a single block, where the block size is the size of the key in the block ciphe ...

Shellys preferences for consumption and leisure can be

Shelly's preferences for consumption and leisure can be expressed as U(C, L) = (C - 100) (L - 40). This utility function implies that Shelly's marginal utility of leisure is C - 100 and her marginal utility of consumptio ...

A student finds that 2496g of water at 249 ordmc density

A student finds that 24.96g of water at 24.9 ºC (density= 0.9971 g/cm3 ) is required to completely fill an empty flask. The water is removed and completely dried; granular solid copper weighing 51.24g is then added to th ...

Couriers such as ups and fedex complete on service and

Couriers such as UPS and FedEx complete on service and price. One way to reduce cost is to keep labor cost low by hiring and laying off workers to meet the demand. This strategy requires managers to hire and train new wo ...

  • 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