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