• Post Reply Bookmark Topic Watch Topic
  • New Topic

calculate an order  RSS feed

 
jigga bull
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
help this is my first tme on a forum and i dont know my way around.
i have a java restaurant ordering program.It is showing the ordering list but it wont calculate the orders.example if i order 2 burger and a fries it should calculate the cost of each burger and fries to give output.
help help help.


code:
CHEESE $100
TOMATO $80
MUSHROOMS $95
GREEN PEPPERS $75
BLACK OLIVES $95
ONIONS $60
PEPPERONI $125
CHICKEN $130
TUNA $140

All pizzas should include CHEESE, TOMATO and the selected pizza base.
These are the prices for the pizza bases:

SMALL BASE $800
MEDIUM BASE $1500
LARGE BASE $2600

Obviously, only one kind of pizza base is allowed per pizza, but the customer
does choose from 3 available pizza bases.


The amount we charge for the pizzas depends on whether the pizza is small, medium, or large and goes like this:


SMALL PIZZA = SMALL base + 1 * price of selected toppings
MEDIUM PIZZA = MEDIUM base + 1.5 * price of selected toppings
LARGE PIZZA = LARGE base + 2 * price of selected toppings

I really don't know much about computers, but I'm eager to learn. However, I'd like the system easy to operate.

You thank the pizza owner, and return to your work place to think about the design and implementation of the pizza ordering system.

Use the code below to implement the functions stated above.



"What I'd like is a system to which I can enter the order the customer wants, and I'd like the system to calculate the price for the pizzas that were ordered. The price depends on the toppings that a pizza has and if the pizzas are small, medium or large.based on what the toppings cost:
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added code tags, which you should always use, to your post, and doesn't it look better.
How much of that code have you written yourself and how much have you been given and instructed to use?
You will never get that code to work if you try creating a GUI. You should get the code working without a GUI at all, and then add the GUI later. You should have classes for the menu items and an order, with appropriate methods to get descriptions and prices from the order. You should be able to call System.out.println(myOrder); and get this sort or output
Order
cheese tomato mushroom pizza $9.85
cheese ham pineapple pizza $10.25
pepperoni ham anchovy pizza $11.00
total: $31.10
It is even better if the total really is £31.10 You will notice I have missed out the sizes, but I hope I have conveyed the general idea of things.
Until you have that sort of thing working, you are on a hiding to nothing trying to create a GUI.
 
jigga bull
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there,i want help on how the code should look like to calculate the orders.it was a half and half effort between me and some guys,but now im lost.i need the correct code to calculate at least one order and i will do the rest .please
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which case you will have to write the code. We do not provide code like that. What has gone wrong with your collaboration?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!