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 sc = new Scanner(System.in);
- int x = Integer.parseInt(sc.nextLine());
- int[] array = {0,0,0,0,0,0,0};
- for (int i = 0; i < x; i++) {
- String color = sc.nextLine();
- switch (color) {
- case "red":
- array[0] += 5;
- array[1]++;
- break;
- case "orange":
- array[0] += 10;
- array[2]++;
- break;
- case "yellow":
- array[0] += 15;
- array[3]++;
- break;
- case "white":
- array[0] += 20;
- array[4]++;
- break;
- case "black":
- array[0] /= 2;
- array[5]++;
- break;
- default: array[6]++;
- }
- }
- System.out.println("Total points: " + array[0]);
- System.out.println("Red balls: " + array[1]);
- System.out.println("Orange balls: " + array[2]);
- System.out.println("Yellow balls: " + array[3]);
- System.out.println("White balls: " + array[4]);
- System.out.println("Divides from black balls: " + array[5]);
- System.out.println("Other colors picked: " + array[6]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement