Question: public static void main(String[] args) { int inputNumber; int sum = 0; int count = 0; double average; Scanner stdin = new Scanner(System.in); System.out.print

public static void main(String[] args) { int inputNumber; int sum = 0;

public static void main(String[] args) { int inputNumber; int sum = 0; int count = 0; double average; Scanner stdin = new Scanner(System.in); System.out.print ("Enter the your lunch today by the calories per food item: "); inputNumber = stdin.nextInt(); while (inputNumber != 0) { sum+= inputNumber; count++; System.out.print ("Enter another calorie qty for any other food item, or 0 if there was no other food: "); inputNumber = stdin.nextInt(); 9e 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 } 27 28 29 30 31 32 33 34 35 36 } 37 38 } if (count==0) { System.out.println("You didn't have anything to eat for lunch?!"); else { average = ((double) sum) * 3; System.out.println(); System.out.println("You consumed a "+sum+" calorie lunch with just "+count+" food items!!"); System.out.println("So, theoretically you eat approximately "+average+" calories per day if your meals were consistant."); stdin.close();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!