Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
224
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 salary{
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int browsersNum = Integer.parseInt(scanner.nextLine());
  8.  
  9. int salary = Integer.parseInt(scanner.nextLine());
  10. int loss = 0;
  11.  
  12. for (int i = 1; i <= browsersNum; i++) {
  13. String site = scanner.nextLine();
  14.  
  15.  
  16. if (site.equalsIgnoreCase("Facebook")) {
  17. loss += 150;
  18. } else if (site.equalsIgnoreCase("Instagram")) {
  19. loss += 100;
  20. } else if (site.equalsIgnoreCase("Reddit")) {
  21. loss += 50;
  22. }
  23.  
  24. }
  25.  
  26. if (loss > salary) {
  27. System.out.println("You have lost your salary.");
  28. } else {
  29. System.out.println(salary - loss);
  30. }
  31.  
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement