Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.95 KB | None | 0 0
  1. package eu.tsachev;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Salary {
  6.     public static void main(String[] args) {
  7.         Scanner scan = new Scanner(System.in);
  8.         int tabs = Integer.parseInt(scan.nextLine());
  9.         int salary = Integer.parseInt(scan.nextLine());
  10.  
  11.         for (int i = 1; i <= tabs; i++) {
  12.             String input = scan.nextLine();
  13.             switch (input) {
  14.                 case "Facebook":
  15.                     salary -= 150;
  16.                     break;
  17.                 case "Instagram":
  18.                     salary -= 100;
  19.                     break;
  20.                 case "Reddit":
  21.                     salary -= 50;
  22.                     break;
  23.             }
  24.                 if (salary <= 0) {
  25.                     System.out.println("You have lost your salary.");
  26.                     break;
  27.                 }
  28.  
  29.  
  30.         }//endof
  31.         if (salary > 0) {
  32.             System.out.println(salary);
  33.         }
  34.  
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement