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 excursionPrice = Double.parseDouble(scanner.nextLine());
- int puzzles = Integer.parseInt(scanner.nextLine());
- double puzzlePrice = 2.60;
- int talkingDolls = Integer.parseInt(scanner.nextLine());
- double talkingDollPrice = 3;
- int teddyBears = Integer.parseInt(scanner.nextLine());
- double teddyBearsPrice = 4.10;
- int minions = Integer.parseInt(scanner.nextLine());
- double minionsPrice = 8.20;
- int trucks = Integer.parseInt(scanner.nextLine());
- double trucksPrice = 2;
- double toysNumber = puzzles + talkingDolls + teddyBears + minions + trucks;
- double counter = (puzzles * puzzlePrice) + (talkingDolls * talkingDollPrice) + (teddyBears * teddyBearsPrice) + (minions * minionsPrice) + (trucks * trucksPrice);
- counter = counter * 0.9;
- if (toysNumber >= 50) {
- counter = counter * 0.75;
- }
- if (counter - excursionPrice >= 0){
- System.out.printf("Yes! %.2f lv left.", counter - excursionPrice);
- } else {
- System.out.printf("Not enough money! %.2f lv needed.", excursionPrice - counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement