Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TrainersSalary {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- double budget = Double.parseDouble(scanner.nextLine());
- double totalResult = 0;
- double result1 = 0;
- double result2 = 0;
- double result3 = 0;
- double result4 = 0;
- double result5 = 0;
- double result6 = 0;
- double moneyPerLesson = 0;
- String string = " ";
- for (int i = 0; i < n; i++) {
- string = scanner.nextLine();
- if (string.equals("Jelev")) {
- result1 += 1;
- } else if (string.equals("RoYaL")) {
- result2 += 1;
- } else if (string.equals("Roli")) {
- result3 += 1;
- } else if (string.equals("Trofon")) {
- result4 += 1;
- } else if (string.equals("Sino")) {
- result5 += 1;
- } else {
- result6 += 1;
- }
- }
- totalResult=result1+result2+result3+result4+result5+result6;
- moneyPerLesson=budget/totalResult;
- System.out.printf("Jelev salary: %.2f lv%n",(result1*moneyPerLesson));
- System.out.printf("RoYaL salary: %.2f lv%n",(result2*moneyPerLesson));
- System.out.printf("Roli salary: %.2f lv%n",(result3*moneyPerLesson));
- System.out.printf("Trofon salary: %.2f lv%n",(result4*moneyPerLesson));
- System.out.printf("Sino salary: %.2f lv%n",(result5*moneyPerLesson));
- System.out.printf("Others salary: %.2f lv",(result6*moneyPerLesson));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement