package org.example; import java.util.Scanner; public class Main { public static void main(String[] args) { int numOfPets = 10; String[] pets = new String[numOfPets]; int[] bills = new int[numOfPets]; Scanner scan = new Scanner(System.in); for (int i = 0; i < numOfPets; i++) { pets[i] = scan.nextLine(); } for (int i = 0; i < numOfPets; i++) { if (pets[i].equals("D")){ System.out.println("Your pet is a dog"); bills[i] = 20; } else if (pets[i].equals("C")){ System.out.println("Your pet is a cat"); bills[i] = 0; } else if (pets[i].equals("P")){ System.out.println("Your pet is a parrot"); bills[i] = 50; } else{ System.out.println("Your pet is not recognized"); bills[i] = 1000; } } int sum = counting(bills, numOfPets); System.out.println("Doctor received " + sum + " zlotys"); } static int counting(int[] array, int numOfPets){ int sum = 0; for (int i = 0; i< numOfPets; i++){ sum = sum + array[i]; } return sum; } }