Win a copy of The Java Performance Companion this week in the Performance forum!

# Java Loops - accumulating totals

Nelineli Nemu
Greenhorn
Posts: 3
Hi I need some guidance on this Java problem.
(I have part of the code that I did at the bottom)

Here's the problem:

Write a program that calculates the cost of buying a burger from the CIS 103 Super Burger store. The menus has four choices to choose from:
Burger 2.15
Combo 1 (Fries + Drink) 3.50
Combo 2 ( Cheese + Fries + Drink) 4.85
Combo 3 (Double Cheese Burger + Fries + Drink) 5.25

The program presents a menu that allows the user to choose the desired burger combo. When the user selects an item, the program displays the cost. When the user selects option 5, the program displays the accumulated total cost.

Sample output

//this is the menu that is suppose to appear

CIS 103 SUPER BURGER
1. Burger
2. Burger Combo1 (Fries + Drink)
3. Burger Comb2 (Cheese + Fries + Drink)
4. Burger Comb3 (Double cheese Burger + Fries + Drink)
5. Done

//user chose 2

You select combo1: \$3.50

CIS 103 SUPER BURGER
1. Burger
2. Burger Combo1 (Fries + Drink)
3. Burger Comb2 (Cheese + Fries + Drink)
4. Burger Comb3 (Double cheese Burger + Fries + Drink)
5. Done

//user chose 4

You select combo3: \$5.25

CIS 103 SUPER BURGER
1. Burger
2. Burger Combo1 (Fries + Drink)
3. Burger Comb2 (Cheese + Fries + Drink)
4. Burger Comb3 (Double cheese Burger + Fries + Drink)
5. Done

//user chose 3

You select combo2: \$4.85

CIS 103 SUPER BURGER
1. Burger
2. Burger Combo1 (Fries + Drink)
3. Burger Comb2 (Cheese + Fries + Drink)
4. Burger Comb3 (Double cheese Burger + Fries + Drink)
5. Done

//user chose 5

The total is \$13.6

Any input/guidance is appreciated.

here's part of what I did:

Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34671
367