Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public class New {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int count = Integer.parseInt(sc.nextLine());
- int salary = Integer.parseInt(sc.nextLine());
- for (int i = 1; i <= count; i++) {
- String type = sc.nextLine();
- switch (type){
- case "Facebook":
- salary-= 150;
- break;
- case "Instagram":
- salary-= 100;
- break;
- case "Reddit":
- salary-= 50;
- break;
- }
- if (salary <= 0){
- System.out.println("You have lost your salary.");
- return;
- }
- }
- System.out.println(salary);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement