Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ToyShop_07 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double tripePrice = Double.parseDouble(scanner.nextLine());
- int puzzleCount = Integer.parseInt(scanner.nextLine());
- int speakDogCount = Integer.parseInt(scanner.nextLine());
- int plushBearCount = Integer.parseInt(scanner.nextLine());
- int minionsCount = Integer.parseInt(scanner.nextLine());
- int trucksCount = Integer.parseInt(scanner.nextLine());
- double puzzlePrice = puzzleCount * 2.6;
- int speakDogPrice = speakDogCount * 3;
- double plushBearPrice = plushBearCount * 4.1;
- double minionPrice = minionsCount * 8.2;
- int truckPrice = trucksCount * 2;
- double totalPriceToy = puzzlePrice + speakDogPrice
- + plushBearPrice + minionPrice + truckPrice;
- int totalToy = puzzleCount + speakDogCount + plushBearCount
- + minionsCount + trucksCount;
- if (totalToy > 50) {
- double afterDiscount = totalPriceToy * 0.25;
- totalPriceToy = totalPriceToy - afterDiscount;
- }
- double rentHall = totalPriceToy * 0.10;
- double totalAfterCosts = totalPriceToy - rentHall;
- if(totalAfterCosts >= tripePrice){
- double leftMoney = totalAfterCosts - tripePrice;
- System.out.printf("Yes! %.2f lv left.", leftMoney);
- } else {
- double leftMoney1 = tripePrice - totalAfterCosts ;
- System.out.printf("Not enough money! %.2f lv needed.",leftMoney1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment