Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package S4_FoorLoops;
- import java.util.Scanner;
- public class Salary {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int tabsCount = Integer.parseInt(scanner.nextLine());
- int salary = Integer.parseInt(scanner.nextLine());
- for (int i = 1; i <= tabsCount; i++) {
- String tabName = scanner.nextLine();
- switch (tabName) {
- 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.");
- break;
- }
- }
- if (salary > 0) {
- System.out.println(salary);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement