Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int kids = 0, adults = 0;
- String input;
- while (!(input = scanner.nextLine()).equals("Christmas")) {
- int years = Integer.parseInt(input);
- if (years <= 16) {
- kids++;
- } else {
- adults++;
- }
- }
- System.out.println("Number of adults: " + adults);
- System.out.println("Number of kids: " + kids);
- System.out.println("Money for toys: " + kids * 5);
- System.out.println("Money for sweaters: " + adults * 15);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement