Advertisement
Dido09

Salary

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