Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ToyShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double vacationPrice = Double.parseDouble(scanner.nextLine());
- int puzzlesCount = Integer.parseInt(scanner.nextLine());
- int talkinDollsCount = Integer.parseInt(scanner.nextLine());
- int teddyBearsCount = Integer.parseInt(scanner.nextLine());
- int minionsCount = Integer.parseInt(scanner.nextLine());
- int trucksCount = Integer.parseInt(scanner.nextLine());
- double puzzlesPrice = 2.60;
- double talkinDollsPrice = 3.00;
- double teddyBearsPrice = 4.10;
- double minionsPrice = 8.20;
- double trucksPrice = 2.00;
- double totalPriceNoDiscount = ((puzzlesCount * puzzlesPrice) + (talkinDollsCount * talkinDollsPrice) + (teddyBearsCount * teddyBearsPrice) + ( minionsCount * minionsPrice) +
- (trucksCount * trucksPrice )) * 0.90;
- double totalPriceDiscount = (((puzzlesCount * puzzlesPrice) + (talkinDollsCount * talkinDollsPrice) + (teddyBearsCount * teddyBearsPrice) + ( minionsCount * minionsPrice) +
- (trucksCount * trucksPrice )) * 0.75) * 0.90;
- int allToysCount = puzzlesCount + talkinDollsCount + teddyBearsCount + minionsCount + trucksCount;
- if (allToysCount >= 50 || vacationPrice < totalPriceDiscount) {
- double moneyEnoughtDiff = totalPriceDiscount - vacationPrice;
- System.out.printf("Yes! " + "%.2f" + " lv left.", moneyEnoughtDiff);
- //"Yes! {оставащите пари} lv left."
- } if (allToysCount < 50 || vacationPrice > totalPriceNoDiscount) {
- double moneyNotEnoughtDiff = vacationPrice - totalPriceNoDiscount;
- System.out.printf("Not enough money! " + "%.2f" + " lv needed." , moneyNotEnoughtDiff );
- //o "Not enough money! {недостигащите пари} lv needed."
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement