galinyotsev123

ProgBasicsExam22and23December2018-E03pastryShop

Dec 30th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E03pastryShop {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String type = scanner.nextLine();
  8. double quantity = Double.parseDouble(scanner.nextLine());
  9. double day = Double.parseDouble(scanner.nextLine());
  10.  
  11. double cake = 00.00;
  12. double souffle = 0.00;
  13. double baklava = 00.00;
  14.  
  15. double sum = 0;
  16. double discount = 0;
  17.  
  18. if (day <=15){
  19. cake = 24.00;
  20. souffle = 6.66;
  21. baklava = 12.60;
  22. }
  23.  
  24. else if (day > 15){
  25. cake = 28.70;
  26. souffle = 9.80;
  27. baklava = 16.98;
  28. }
  29.  
  30. if(type.equalsIgnoreCase("cake")){
  31. sum = cake * quantity;
  32. }
  33.  
  34. else if (type.equalsIgnoreCase("souffle")){
  35. sum = souffle * quantity;
  36. }
  37.  
  38. else if (type.equalsIgnoreCase("baklava")){
  39. sum = baklava * quantity;
  40. }
  41.  
  42. if( day <= 15){
  43. sum *=0.90;
  44. }
  45.  
  46. if (day <=22){
  47. if (sum <= 100 || sum <= 200){
  48. sum *= 0.85;
  49. }
  50.  
  51. else if (sum > 200){
  52. sum *= 0.75;
  53. }
  54. }
  55.  
  56.  
  57. System.out.printf("%.2f", sum);
  58.  
  59.  
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment