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