0

Need a hand on this code!

public class Clerk { GroceryStore myStore; public void takePosition(GroceryStore store) { myStore = store; } public double ringUp(GroceryItem[] item) { double total = 0; int itemNumber = 0; while (item[itemNumber] != null) { total = total + item[itemNumber].price; System.out.println(item[itemNumber].name + " " + item[itemNumber].price); itemNumber = itemNumber + 1; } System.out.println("TOTAL " + total); return total; } public void pay(double amount) { myStore.money = myStore.money + amount; } }

30th Nov 2021, 6:44 PM
Jade Niño C. Morados
Jade Niño C. Morados - avatar
2 Antworten
30th Nov 2021, 7:02 PM
Simon Sauter
Simon Sauter - avatar
0
while (itemNumber < item.length && item[itemNumber] != null) {
1st Dec 2021, 1:26 AM
zemiak