Advertisement
desislava_topuzakova

Untitled

Jan 22nd, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class ToyShop {
  3. public static void main(String[] args) {
  4. Scanner scanner=new Scanner(System.in);
  5. double trip_price=Double.parseDouble(scanner.nextLine());
  6. int puzzles=Integer.parseInt(scanner.nextLine());
  7. int dolls=Integer.parseInt(scanner.nextLine());
  8. int bears=Integer.parseInt(scanner.nextLine());
  9. int minnions=Integer.parseInt(scanner.nextLine());
  10. int trucks=Integer.parseInt(scanner.nextLine());
  11. double sum=puzzles*2.6+dolls*3+bears*4.10+minnions*8.2+trucks*2;
  12. double broi=puzzles+dolls+bears+minnions+trucks;
  13. if(broi>=50){
  14. double cena=(sum-(0.25*sum))-((sum-(0.25*sum))*0.1);
  15. if(cena>=trip_price)
  16. {double ost=cena-trip_price;
  17. System.out.print("Yes! ");
  18. System.out.printf("%.2f",ost);
  19. System.out.print(" lv left.");}
  20. else if(cena<trip_price)
  21. {double raz=trip_price-cena;
  22. System.out.print("Not enough money! ");
  23. System.out.printf("%.2f",raz);
  24. System.out.print(" lv needed.");}}
  25. else if(broi<50){double price=sum-(sum*0.1);
  26. if(price>=trip_price)
  27. {double ost=price-trip_price;
  28. System.out.print("Yes! ");
  29. System.out.printf("%.2f",ost);
  30. System.out.print(" lv left.");}
  31. else if(price<trip_price)
  32. {double raz=trip_price-price;
  33. System.out.print("Not enough money! ");
  34. System.out.printf("%.2f",raz);
  35. System.out.print(" lv needed.");}
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement