Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 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. int n = Integer.parseInt(scanner.nextLine());
  7. int salary = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int i = 0; i < n; i++) {
  10. String webSite = scanner.nextLine().toLowerCase();
  11. if (webSite.equals("facebook")) {
  12. salary = salary - 150;
  13. }
  14. if (webSite.equals("instagram")) {
  15. salary = salary - 100;
  16. }
  17. if (webSite.equals("reddit")) {
  18. salary = salary - 50;
  19. }
  20. }
  21. if(salary>0)
  22. System.out.println(salary);
  23. if (salary <= 0){
  24. System.out.println("You have lost your salary");
  25. }
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement