Advertisement
Deiancom

ToyStore2

Sep 16th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.57 KB | None | 0 0
  1. package ConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class ToyShop {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         double excursionPrice = Double.parseDouble(scanner.nextLine());
  9.         int puzzlesCount = Integer.parseInt(scanner.nextLine());
  10.         int talkingDollsCount = Integer.parseInt(scanner.nextLine());
  11.         int teddyBearsCount = Integer.parseInt(scanner.nextLine());
  12.         int minionsCount = Integer.parseInt(scanner.nextLine());
  13.         int trucksCount = Integer.parseInt(scanner.nextLine());
  14.  
  15.         double puzzlesPrice = puzzlesCount * 2.60;
  16.         double talkingDollsPrice = talkingDollsCount * 3;
  17.         double teddyBearsPrice = teddyBearsCount * 4.10;
  18.         double minionsPrice = minionsCount * 8.20;
  19.         double trucksPrice = trucksCount * 2;
  20.         double profitBeforeExpenses = puzzlesPrice + talkingDollsPrice + teddyBearsPrice + minionsPrice + trucksPrice;
  21.         double toysCount = puzzlesCount + talkingDollsCount + teddyBearsCount + minionsCount + trucksCount;
  22.         if (toysCount >= 50) {
  23.             profitBeforeExpenses = profitBeforeExpenses - (profitBeforeExpenses * 0.25);
  24.         }
  25.         profitBeforeExpenses = profitBeforeExpenses - (profitBeforeExpenses * 0.10);
  26.         if (profitBeforeExpenses >= excursionPrice) {
  27.             System.out.printf("Yes! %.2f lv left.",profitBeforeExpenses - excursionPrice);
  28.         }else {
  29.             System.out.printf("Not enough money! %.2f lv needed.", excursionPrice - profitBeforeExpenses);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement