Advertisement
Kancho

Toy_Wharehouse

Jan 26th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Toys_Wharehouse {
  4. public static void main(String[] args) {
  5.  
  6. Scanner keyboard = new Scanner(System.in);
  7. System.out.print("Enter the price of the excursion: ");
  8. double excursionPrice = keyboard.nextDouble();
  9. System.out.print("Number of puzzles: ");
  10. int countPuzzles = keyboard.nextInt();
  11. System.out.print("Number of dolls: ");
  12. int countDolls = keyboard.nextInt();
  13. System.out.print("Number of teddybears: ");
  14. int countTeddyBears = keyboard.nextInt();
  15. System.out.print("Number of trucks: ");
  16. int countTrucks = keyboard.nextInt();
  17. System.out.print("Number of minions: ");
  18. int countMinions = keyboard.nextInt();
  19. double profitPuzzles = countPuzzles * 2.60;
  20. double profitDoll = countDolls * 3.00;
  21. double profitTeddyBears = countTeddyBears * 4.10;
  22. double profitMinions = countMinions * 8.20;
  23. double profitTrucks = countTrucks * 2.00;
  24. double totalCount = countPuzzles + countDolls + countTeddyBears + countMinions + countTrucks;
  25. double totalProfit = profitPuzzles + profitDoll + profitTeddyBears + profitMinions + profitTrucks;
  26. if (totalCount >= 50) {
  27. totalCount = totalCount - (totalCount * 0.25);
  28. }
  29. totalProfit = totalProfit - (totalProfit * 0.1);
  30. if (totalProfit >= excursionPrice) {
  31. System.out.printf("Yes, you have excess of %.2f BGN", totalProfit - excursionPrice);
  32. } else {
  33. System.out.printf("Sorry, You lack %.2f BGN", excursionPrice - totalProfit);
  34.  
  35. }
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement