How do you program this java problem?

i am 5 weeks into my class and totally clueless i could use the help.

The local pizza parlour has an on-line page that will allow customers to select items from the

menu, specify how many of each item to buy, and see how much an order will cost.

The menu includes:

Cheese pizza:

Large $9.00

Medium $7.50

Pepperoni pizza:

Large $10.50

Medium $8.50

Buffalo Wings (dozen) $6.00

The store also offers today’s special: If you buy at least two medium pizzas of any type, you will

receive $2 off the price of your order.

The total cost of the order, after taking any discount for the special deal, will include New York

State sales tax at 8.25%.

Write a program that performs the following operations:

• Allow the user to type in how many of each item they want to buy.

• If the user buys more than 2 or more medium pizzas of either kind, they should get $2

discount off their total price.

• When the user is done, display a bill showing the price results: it should include the

subtotal of the price of all items, the discount (if the order qualified for it), the discounted

price, the sales tax amount and the grand total.

• Allow the user to clear the items and totals in order to start over.

Comments

  • I don't know if this is a GUI app or not. I'll assume command-line, and that you know how to get input from the command-line. You'll need 3 Vectors of item quantities, prices and descriptions (optional). You could bundle them all up in class, but I won't for this description. Then you just get input from the user, .e.g.:

    How many Large Pepperoni pizzas?: 1

    Just shove the quantities into the correct slot in the Vector (e.g. quantityVector.add(inputQuantity)). After they're done ordering, just iterate over the quantities Vector and multiply the quantity by the price, e.g.:

    int i=0;

    float total = 0;

    for( int itemQuantity: quantityVector )

    {

    total += itemQuantity * priceVector[i++];

    }

    Then look at the two medium slots and see if they ordered at least two medium pizzas. If so, set a boolean indicating they get the promotional $2 off. Then take the resulting total (with bonus applied if they got it), multiply it by 1.0825 and slap it into a grandTotal variable. Then all that's left to do is print out the totals. Easy. Then tell the user to enter something like -1 to start over. HTH

  • examine each and every sort by way of taking mod by way of 10 and loop For evry sort examine in spite of if it somewhat is unusual or perhaps to illustrate : enable n as enter numbr enable O as sum of wierd numbers,O = 0 enable E as sum of even numbers ,E = 0 on an identical time as(n>0) { enable c = npercent10 if (cpercent2 == 0 { E = E + c } else { O = O + c } n = n/10 }

  • This is a very easy program to write. If you want somebody to write it then I would recommend freelancer.com

    My name on www.getafreelancer.com is programtherapist if you want to request for me to write the program for you.h

Sign In or Register to comment.