Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package OldExams;
- import java.util.Scanner;
- import java.util.function.DoublePredicate;
- public class ToyShop {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double holidayPrice = Double.parseDouble(scanner.nextLine());
- double puzzle = Integer.parseInt(scanner.nextLine());
- double dolls = Integer.parseInt(scanner.nextLine());
- double bears = Integer.parseInt(scanner.nextLine());
- double minions = Integer.parseInt(scanner.nextLine());
- double trucks = Integer.parseInt(scanner.nextLine());
- double sumToys = puzzle * 2.60 + dolls * 3 + bears * 4.10 + minions * 8.20 + trucks * 2;
- double numToys = puzzle + dolls + bears + minions + trucks;;
- if (numToys >= 50){
- sumToys -= sumToys * 0.25;
- }
- sumToys -= sumToys * 0.1;
- if (sumToys >= holidayPrice){
- System.out.printf("Yes! %.2f lv left.",sumToys - holidayPrice );
- }else {
- System.out.printf("Not enough money! %.2f lv needed.", holidayPrice - sumToys);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement