Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SamiqtIzpit;
- import java.util.Scanner;
- public class P05 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int dailyGoal = Integer.parseInt(scanner.nextLine());
- int moneyCount = 0;
- while (moneyCount < dailyGoal) {
- String command = scanner.nextLine();
- if (!command.equals("closed")) {
- String type = scanner.nextLine();
- if (command.equals("haircut")) {
- if (type.equals("mens")) {
- moneyCount += 15;
- } else if (type.equals("ladies")) {
- moneyCount += 20;
- } else if (type.equals("kids")) {
- moneyCount += 10;
- }
- }
- if (command.equals("color")) {
- if (type.equals("touch up")) {
- moneyCount += 20;
- } else if (type.equals("full color")) {
- moneyCount += 30;
- }
- }
- }
- if (command.equals("closed")) {
- break;
- }
- }
- if (moneyCount >= dailyGoal) {
- System.out.println("You have reached your target for the day!");
- System.out.println("Earned money: " + moneyCount + "lv.");
- } else {
- int diff = Math.abs(dailyGoal - moneyCount);
- System.out.println("Target not reached! You need " + diff + "lv. more.");
- System.out.println("Earned money: " + moneyCount + "lv.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement