Advertisement
MeGaM1nd

Untitled

Oct 17th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Dance {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int counterTabs = Integer.parseInt(scanner.nextLine());
  10. int salary = Integer.parseInt(scanner.nextLine());
  11.  
  12. for (int tab = 0; tab < counterTabs; tab++) {
  13. String webSite = scanner.nextLine();
  14.  
  15. if ("Facebook".equals(webSite)) {
  16. salary -= 150;
  17. } else if ("Instagram".equals(webSite)) {
  18. salary -= 100;
  19.  
  20. } else if ("Reddit".equals(webSite)) {
  21. salary -= 50;
  22. }
  23. if (salary <= 0){
  24. System.out.println("You have lost your salary.");
  25. break;
  26. }
  27. }
  28. if (salary > 0){
  29. System.out.println(salary);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement