Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ConditionalStatements;
- import java.util.Scanner;
- public class ToyShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double excursionPrice = Double.parseDouble(scanner.nextLine());
- int puzzlesCount = Integer.parseInt(scanner.nextLine());
- int talkingDollsCount = Integer.parseInt(scanner.nextLine());
- int teddyBearsCount = Integer.parseInt(scanner.nextLine());
- int minionsCount = Integer.parseInt(scanner.nextLine());
- int trucksCount = Integer.parseInt(scanner.nextLine());
- double puzzlesPrice = puzzlesCount * 2.60;
- double talkingDollsPrice = talkingDollsCount * 3;
- double teddyBearsPrice = teddyBearsCount * 4.10;
- double minionsPrice = minionsCount * 8.20;
- double trucksPrice = trucksCount * 2;
- double profitBeforeExpenses = puzzlesPrice + talkingDollsPrice + teddyBearsPrice + minionsPrice + trucksPrice;
- double toysCount = puzzlesCount + talkingDollsCount + teddyBearsCount + minionsCount + trucksCount;
- if (toysCount >= 50) {
- profitBeforeExpenses = profitBeforeExpenses - (profitBeforeExpenses * 0.25);
- }
- profitBeforeExpenses = profitBeforeExpenses - (profitBeforeExpenses * 0.10);
- if (profitBeforeExpenses >= excursionPrice) {
- System.out.printf("Yes! %.2f lv left.",profitBeforeExpenses - excursionPrice);
- }else {
- System.out.printf("Not enough money! %.2f lv needed.", excursionPrice - profitBeforeExpenses);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement