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