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