Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int tabs = Integer.parseInt(scanner.nextLine());
- int salary = Integer.parseInt(scanner.nextLine());
- for (int tab = 1; tab <= tabs; tab++) {
- String siteName = scanner.nextLine();
- if ("Facebook".equals(siteName)) {
- salary -= 150;
- } else if ("Reddit".equals(siteName)) {
- salary -= 100;
- } else if ("Instagram".equals(siteName)) {
- salary -= 50;
- }
- //проверка дали имаме заплата
- if (salary <= 0) {
- System.out.println("You have lost your salary.");
- break;
- }
- }
- System.out.println(salary);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment