EliPerfanova

Untitled

Sep 12th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.util.Scanner;
  3.  
  4. public class ToyShop {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         double priceOfV = Double.parseDouble(scanner.nextLine());
  9.         int P = Integer.parseInt(scanner.nextLine());
  10.         int dolls = Integer.parseInt(scanner.nextLine());
  11.         int bears = Integer.parseInt(scanner.nextLine());
  12.         int minions = Integer.parseInt(scanner.nextLine());
  13.         int trucks = Integer.parseInt(scanner.nextLine());
  14.  
  15.         double price = ( P * 2.60 ) + ( dolls * 3 ) + ( bears * 4.10 ) + ( minions * 8.20 ) + ( trucks * 2 );
  16.         int toys = P + dolls + bears + minions + trucks;
  17.  
  18.         if (toys >= 50) {price = price - (price * 0.25);}
  19.         else price=price;
  20.  
  21.         double afterRent = price * 0.9;
  22.         double left = afterRent - priceOfV;
  23.         double need = priceOfV - afterRent;
  24.  
  25.         if (left > priceOfV) {System.out.printf("Yes! %.2f lv left.",left);}
  26.         else if (priceOfV > need) {System.out.printf("Not enough money! %.2f lv needed.", need);}
  27.        
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment