Advertisement
paykova

TrainersSalary

Oct 13th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TrainersSalary {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int n = Integer.parseInt(scanner.nextLine());
  7. double budget = Double.parseDouble(scanner.nextLine());
  8. double totalResult = 0;
  9. double result1 = 0;
  10. double result2 = 0;
  11. double result3 = 0;
  12. double result4 = 0;
  13. double result5 = 0;
  14. double result6 = 0;
  15. double moneyPerLesson = 0;
  16. String string = " ";
  17.  
  18. for (int i = 0; i < n; i++) {
  19. string = scanner.nextLine();
  20. if (string.equals("Jelev")) {
  21. result1 += 1;
  22. } else if (string.equals("RoYaL")) {
  23. result2 += 1;
  24. } else if (string.equals("Roli")) {
  25. result3 += 1;
  26. } else if (string.equals("Trofon")) {
  27. result4 += 1;
  28. } else if (string.equals("Sino")) {
  29. result5 += 1;
  30. } else {
  31. result6 += 1;
  32. }
  33. }
  34. totalResult=result1+result2+result3+result4+result5+result6;
  35. moneyPerLesson=budget/totalResult;
  36. System.out.printf("Jelev salary: %.2f lv%n",(result1*moneyPerLesson));
  37. System.out.printf("RoYaL salary: %.2f lv%n",(result2*moneyPerLesson));
  38. System.out.printf("Roli salary: %.2f lv%n",(result3*moneyPerLesson));
  39. System.out.printf("Trofon salary: %.2f lv%n",(result4*moneyPerLesson));
  40. System.out.printf("Sino salary: %.2f lv%n",(result5*moneyPerLesson));
  41. System.out.printf("Others salary: %.2f lv",(result6*moneyPerLesson));
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement