Advertisement
valkata

Salary

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