Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Zadacha94 {
  4.  
  5. public static void main(String[] args) {
  6. Scanner sc = new Scanner(System.in);
  7. String type= sc.nextLine();
  8. int ammount=Integer.parseInt(sc.nextLine());
  9. int budget=Integer.parseInt(sc.nextLine());
  10.  
  11.  
  12. double leftover;
  13. double price=0;
  14. double cost=price*ammount;
  15.  
  16. switch (type){
  17. case "Roses":
  18. price=5;
  19. cost=price*ammount;
  20.  
  21. if (ammount>=80)
  22. {
  23. price=price*0.9;
  24. cost=price*ammount;
  25. if (cost>budget){
  26. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  27. }
  28. else if (cost<=budget){
  29. leftover= budget - cost;
  30.  
  31. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+leftover+" leva left.");
  32.  
  33. }
  34. }
  35. else if (ammount<80)
  36. {
  37. if (cost>budget){
  38. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  39. }
  40. else if (cost<=budget){
  41. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+(budget-cost)+" leva left.");
  42.  
  43. }
  44. }
  45. break;
  46. case "Dahlias":
  47. price=3.8;
  48. cost=price*ammount;
  49.  
  50. if (ammount>=90)
  51. {
  52. price=price*0.85;
  53. cost=price*ammount;
  54. if (cost>budget){
  55. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  56. }
  57. else if (cost<=budget){
  58. leftover= budget - cost;
  59.  
  60. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+leftover+" leva left.");
  61.  
  62. }
  63. }
  64. else if (ammount<90)
  65. {
  66. if (cost>budget){
  67. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  68. }
  69. else if (cost<=budget){
  70. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+(budget-cost)+" leva left.");
  71.  
  72. }
  73. }
  74. break;
  75. case "Tulips":
  76. price=2.8;
  77. cost=price*ammount;
  78.  
  79. if (ammount>=80)
  80. {
  81. price=price*0.85;
  82. cost=price*ammount;
  83. if (cost>budget){
  84. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  85. }
  86. else if (cost<=budget){
  87. leftover= budget - cost;
  88.  
  89. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+leftover+" leva left.");
  90.  
  91. }
  92. }
  93. else if (ammount<80)
  94. {
  95. if (cost>budget){
  96. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  97. }
  98. else if (cost<=budget){
  99. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+(budget-cost)+" leva left.");
  100.  
  101. }
  102. }
  103. break;
  104. case "Narcissus":
  105. price=3;
  106. cost=price*ammount;
  107.  
  108. if (ammount<120)
  109. {
  110. price=price*1.15;
  111. cost=price*ammount;
  112. if (cost>budget){
  113. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  114. }
  115. else if (cost<=budget){
  116. leftover= budget - cost;
  117.  
  118. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+leftover+" leva left.");
  119.  
  120. }
  121. }
  122. else if (ammount>=120)
  123. {
  124. if (cost>budget){
  125. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  126. }
  127. else if (cost<=budget){
  128. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+(budget-cost)+" leva left.");
  129.  
  130. }
  131. }
  132. break;
  133. case "Gladiolus":
  134. price=2.50;
  135. cost=price*ammount;
  136.  
  137. if (ammount<80)
  138. {
  139. price=price*1.2;
  140. cost=price*ammount;
  141. if (cost>budget){
  142. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  143. }
  144. else if (cost<=budget){
  145. leftover= budget - cost;
  146.  
  147. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+leftover+" leva left.");
  148.  
  149. }
  150. }
  151. else if (ammount>=80)
  152. {
  153. if (cost>budget){
  154. System.out.println("Not enough money, you need "+(cost-budget)+" leva more.");
  155. }
  156. else if (cost<=budget){
  157. System.out.println("Hey, you have a great garden with "+ammount+type+" and "+(budget-cost)+" leva left.");
  158.  
  159. }
  160. }
  161. break;
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175. }
  176. }
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement