grach

KidStore

Mar 22nd, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class KidStore {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         double priceExcursion = Double.parseDouble(scan.nextLine());
  8.  
  9.         int countPuzzles = Integer.parseInt(scan.nextLine());
  10.         int countDolls =   Integer.parseInt(scan.nextLine());
  11.         int countBear =    Integer.parseInt(scan.nextLine());
  12.         int countMinions = Integer.parseInt(scan.nextLine());
  13.         int countTrucks =  Integer.parseInt(scan.nextLine());
  14.  
  15.         int countAll = countBear+countDolls+countMinions+countPuzzles+countTrucks;
  16.  
  17.  
  18.         double totalPrice = countPuzzles*2.60 + countDolls*3 + countBear*4.1+countMinions*8.2+countTrucks*2;
  19.  
  20.  
  21.         if (countAll>=50){
  22.           totalPrice=totalPrice*0.75;
  23. }
  24.         totalPrice=totalPrice*0.9;
  25.  
  26.           if (totalPrice>priceExcursion){
  27.               System.out.printf("Yes! %.2f lv left.",totalPrice-priceExcursion);
  28.           }
  29.  
  30.           else {
  31.               System.out.printf("Not enough money! %.2f lv needed.", priceExcursion-totalPrice);
  32.           }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment