Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by Bubeto on 5/11/2017.
- */
- public class ToyShops1 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double puzzle = 2.6;
- double doll = 3;
- double bear = 4.1;
- double minion = 8.2;
- double truck = 2;
- double priceTour = Double.parseDouble(scanner.nextLine());
- int countPuzzle = Integer.parseInt(scanner.nextLine());
- int countDoll = Integer.parseInt(scanner.nextLine());
- int countBear = Integer.parseInt(scanner.nextLine());
- int countMinion = Integer.parseInt(scanner.nextLine());
- int countTruck = Integer.parseInt(scanner.nextLine());
- int countToys = countPuzzle + countDoll + countBear + countMinion + countTruck;
- double priceToys = puzzle*countPuzzle + doll*countDoll + bear*countBear + minion*countMinion + truck*countTruck;
- double realPrice = 0;
- if (countToys >= 50){
- priceToys = priceToys - 0.25*priceToys;
- realPrice = priceToys - 0.1*priceToys;
- if(priceTour <= realPrice){
- System.out.printf("Yes! %.2f lv left.", realPrice - priceTour);
- }
- else {
- System.out.printf("Not enough money! %.2f lv needed.", priceTour - realPrice);
- }
- }
- else {
- realPrice = priceToys - 0.1*priceToys;
- if(priceTour <= realPrice){
- System.out.printf("Yes! %.2f lv left.", realPrice - priceTour);
- }
- else {
- System.out.printf("Not enough money! %.2f lv needed.", priceTour - realPrice);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement