Advertisement
Dido09

Store

Sep 18th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Store {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. double tripPrize = Double.parseDouble(scanner.nextLine());
  8. int puzzlesCount = Integer.parseInt(scanner.nextLine());
  9. int dollsCount = Integer.parseInt(scanner.nextLine());
  10. int bearsCount = Integer.parseInt(scanner.nextLine());
  11. int minionsCount = Integer.parseInt(scanner.nextLine());
  12. int trucksCount = Integer.parseInt(scanner.nextLine());
  13.  
  14. double totalPrice = puzzlesCount * 2.60 + dollsCount * 3 + bearsCount * 4.10
  15. + minionsCount * 8.20 + trucksCount * 2;
  16.  
  17. int items = puzzlesCount + dollsCount + bearsCount + minionsCount + trucksCount;
  18.  
  19. if(items >= 50) {
  20. totalPrice = totalPrice * 0.75;
  21. }
  22. totalPrice = totalPrice * 0.90;
  23.  
  24. if(totalPrice >= tripPrize){
  25. System.out.printf("Yes! %.2f lv left.", totalPrice - tripPrize);
  26. }else{
  27. System.out.printf("Not enough money! %.2f lv needed.", tripPrize - totalPrice);
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement