0

Hi,

I am trying to do an assignment about buying zoo tickets but I am becoming stuck on the last hurdle when trying to get the accumulate number.

```
import java.util.Scanner;
public class ZooTaking {
public static void main(String[] args) {
// Create a Scanner
Scanner input = new Scanner(System.in);
// Ask if a new group is to be added
System.out.print("Enter a group? (Yes=1/No=0): ");
int i = input.nextInt();
int sum = 0;
while (i != 0) {
sum += i;
// Enter the number of accompanied children
System.out.print("Enter the number of accompanied children (age 6-15): ");
int accompaniedChildren = input.nextInt();
// Enter the number of unaccompanied children
System.out.print("Enter the number of unaccompanied children (age 6-15): ");
int unaccompaniedChildren = input.nextInt();
// Enter the number of adults
System.out.print("Enter the number of adults (age 16-59): ");
int adult = input.nextInt();
// Enter the number of seniors
System.out.print("Enter the number of seniors (age 60+): ");
int senior = input.nextInt();
// Calculate total entry charge
int totalTakings = (accompaniedChildren * 1) + (unaccompaniedChildren * 5) + (adult * 10) + (senior * 7);
// Display results
System.out.println("Total entry charge is $" + totalTakings);
System.out.print("Enter a group? (Yes=1/No=0): ");
i = input.nextInt();
}
System.out.println("Total takings: $" + sum);
}
}
```

I am trying to get the Total takings, once the program has ended, if the program is looped many times. I keep on getting how many times the program is looped but not how much the total takings should be.

Any help will be greatly appreciated.

Thanks.