desislava_topuzakova

Untitled

Jan 31st, 2022
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int tabs = Integer.parseInt(scanner.nextLine());
  7. int salary = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int tab = 1; tab <= tabs; tab++) {
  10. String siteName = scanner.nextLine();
  11. if ("Facebook".equals(siteName)) {
  12. salary -= 150;
  13. } else if ("Reddit".equals(siteName)) {
  14. salary -= 100;
  15. } else if ("Instagram".equals(siteName)) {
  16. salary -= 50;
  17. }
  18. //проверка дали имаме заплата
  19. if (salary <= 0) {
  20. System.out.println("You have lost your salary.");
  21. break;
  22. }
  23. }
  24. System.out.println(salary);
  25. }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment