Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Store {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double tripPrize = Double.parseDouble(scanner.nextLine());
- int puzzlesCount = Integer.parseInt(scanner.nextLine());
- int dollsCount = Integer.parseInt(scanner.nextLine());
- int bearsCount = Integer.parseInt(scanner.nextLine());
- int minionsCount = Integer.parseInt(scanner.nextLine());
- int trucksCount = Integer.parseInt(scanner.nextLine());
- double totalPrice = puzzlesCount * 2.60 + dollsCount * 3 + bearsCount * 4.10
- + minionsCount * 8.20 + trucksCount * 2;
- int items = puzzlesCount + dollsCount + bearsCount + minionsCount + trucksCount;
- if(items >= 50) {
- totalPrice = totalPrice * 0.75;
- }
- totalPrice = totalPrice * 0.90;
- if(totalPrice >= tripPrize){
- System.out.printf("Yes! %.2f lv left.", totalPrice - tripPrize);
- }else{
- System.out.printf("Not enough money! %.2f lv needed.", tripPrize - totalPrice);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement