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);
- int n = Integer.parseInt(scanner.nextLine());
- int widget = Integer.parseInt(scanner.nextLine());
- for (int i = 0; i < n; i++) {
- String site = scanner.nextLine();
- switch (site) {
- case "Facebook":
- widget -= 150;
- break;
- case "Instagram":
- widget -= 100;
- break;
- case "Reddit":
- widget -= 50;
- break;
- default:
- widget -= 0;
- break;
- }
- if (widget == 0) {
- break;
- }
- }
- if (widget == 0) {
- System.out.println("You have lost your salary.");
- } else {
- System.out.println(widget);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement