Advertisement
Ivakis

Плодови коктейли

Oct 10th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String fruit = scanner.nextLine();
  8. String size = scanner.nextLine();
  9. int count = Integer.parseInt(scanner.nextLine());
  10.  
  11. double price = 0;
  12. if(size.equals("small")){
  13. if(fruit.equals("Watermelon")){
  14. price = 2 * 56;
  15. }else if(fruit.equals("Mango")){
  16. price = 2 * 36.66;
  17. }else if(fruit.equals("Pineapple")){
  18. price = 2 * 42.1;
  19. }else if(fruit.equals("Raspberry")){
  20. price = 2 * 20;
  21. }
  22. }else{
  23. switch (fruit) {
  24. case "Watermelon":
  25. price = 5 * 28.7;
  26. break;
  27. case "Mango":
  28. price = 5 * 19.60;
  29. break;
  30. case "Pineapple":
  31. price = 5 * 24.80;
  32. break;
  33. case "Raspberry":
  34. price = 5 * 15.20;
  35. break;
  36. }
  37. }
  38. double totalPrice = count * price;
  39.  
  40. if(totalPrice >= 400 && totalPrice <= 1000){
  41. totalPrice = totalPrice - (totalPrice * 0.15);
  42. }else if(totalPrice > 1000){
  43. totalPrice = totalPrice - (totalPrice * 0.50);
  44. }
  45.  
  46. System.out.printf("%.2f lv.", totalPrice);
  47.  
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement