answersLogoWhite

0


Best Answer

Pizza class:

The Pizza class represents a pizza order. It has fields to store the customer's name, pizza size, number of toppings, and cost of the pizza. Write the Pizza class with these requirements:

  • Add the 4 fields used by this class. All fields should be set to private, and use descriptive variable names.
  • Create a constructor that takes 3 parameters: a String to initialize the customer name, a String to initialize the pizza size (small, medium, or large), and an int to initialize the number of toppings. The cost will be initialized using the calculateCost method described below.
  • Write an accessor method named getName that returns the name from the order.
  • Write a mutator method named calculateCost to calculate the cost of the pizza order as follows:

    A small pizza is $8, and toppings are $1 each.

    A medium pizza is $10, and toppings are $2 each.

    A large pizza is $12, and toppings are $3 each.

    Additionally, if the customer orders 4 or more toppings, there is a $2 discount of the price of the pizza, regardless of the size.

    This method will set the cost of the pizza.

  • Write an accessor named getCost that returns the cost of the pizza.
  • Write a mutator method named applyDiscount that takes an int parameter and reduces the cost of the pizza by the parameter amount.
  • Write a method named printDetails that will print out the Pizza object details as shown below:

    Bales, medium 3-topping pizza: $16

Orders class:

The Orders class represents a number of orders for a pizza shop. It has 4 fields: three Pizza objects, and one String field that stores a day of the week.

  • Add the four (4) fields for this class.
  • Add the constructor for this class. It takes one String parameter to set the day of the week. Within the constructor, initialize the Pizza objects as follows: ("Bales", "medium", 3), ("Marts", "small", 2), ("Donal", "large", 6).
  • Add a method, applyCoupon, that takes one String parameter, a name. It will match the name to the customer name of one of the Pizza objects, and apply a discount of $1, $2, or $3. The amount should be chosen randomly. If there is no Pizza object with this name, an appropriate error message should be printed.
  • Add a method called printOrders that will do the following 3 things:
    1. Apply a coupon to the order for Donal
    2. Calculate the total price for all three pizza orders.
    3. Print out the orders as shown below:

      Pizza orders for Wednesday

      Bales, medium 3-topping pizza: $16

      Marts, small 2-topping pizza: $10

      Donal, large 6-topping pizza: $25

      ---------------------------------------

      Total sales for Wednesday: $51

    Keep in mind that your total may be different since the coupon amount was random.
User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Need help with basic blueJ pizza program.?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What do you need to run blue j on your windows xp computer?

first of all you need java and to have all your computer updated. then you can download the free bluej program that is specially to intruduce java aplication. =P... have fun, u can do many tings with bluej...XD


How do you write a program to find out the square and cube of first ten natural numbers in gw basic?

First you will need to have some basic programming knowledge. You can use this to help make the program that is needed.


What Qualifications do you have to have to apply for Pizza Hut?

you have to be 16 and if you are in high school and you get haird you must get a work pemint


What license does pizza shop need?

a5 pizza what is this


Why do cheese pizza need pizza crust?

All pizza needs crust to keep the sauce and toppings in the pizza


what is test of pizza woodfire?

you need to make pizza with wood fire


How much math is needed to program Visual Basic?

You don't really need math to write programs in Visual Basic or most any other language unless the program is about mathematical situations. Understanding of mathematical logic concept (AND OR NOT IMPLIES) does makes thing easier.


You want to regester for Pizza Hut need apllication?

Your local Pizza Hut.


Can I legally distribute for no charge a Visual Basic program that I wrote or do I need some type of license?

You need to develop the VB program with a non student version of VB/VS. You can distribute the redistributable DLL's, but you can not distribute the debug versions. See your EULA.


What is the need of object oriented system?

There is no strict need for object oriented programming, people have programmed for a long time without it. However, OOP does make programs much easier to program, and to maintain - once you graps the basic ideas of OOP.There is no strict need for object oriented programming, people have programmed for a long time without it. However, OOP does make programs much easier to program, and to maintain - once you graps the basic ideas of OOP.There is no strict need for object oriented programming, people have programmed for a long time without it. However, OOP does make programs much easier to program, and to maintain - once you graps the basic ideas of OOP.There is no strict need for object oriented programming, people have programmed for a long time without it. However, OOP does make programs much easier to program, and to maintain - once you graps the basic ideas of OOP.


Do I need special education to get in to the tax software business?

If you are creating basic software the only thing you would need to know is how to program. If you are not a programmer, but are a tax specialist you just need to find a programmer to help you.


Why don't they put pizza sauce to the edge of a pizza?

you need somewhere to hold onto the pizza (the crust) and also it gives you different tastes for the middle of the pizza:):):)