Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. package com.company;
  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 num = Integer.parseInt(scan.nextLine());
  9. int salary = Integer.parseInt(scan.nextLine());
  10.  
  11. for (int i = 0; i < num; i++) {
  12. String site = scan.nextLine();
  13. switch (site) {
  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.printf("You have lost your salary.");
  26. break;
  27. }
  28. }
  29. if (salary >0) {
  30. System.out.println(salary);}
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement