Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class WeddingInvestment {
  4. public static void main(String[] args) {
  5. Scanner sc = new Scanner(System.in);
  6. String years = sc.nextLine();
  7. String type = sc.nextLine();
  8. String dessert = sc.nextLine();
  9. int months = Integer.parseInt(sc.nextLine());
  10.  
  11. double total = 0;
  12. double totalSumForMonths = 0;
  13.  
  14. switch (years) {
  15. case "one":
  16. if (type.equals("Small") && dessert.equals("yes")) {
  17. total = 9.98 + 5.5;
  18. totalSumForMonths = total * months;
  19. } else if (type.equals("Small") && dessert.equals("no")) {
  20. total = 9.98;
  21. totalSumForMonths = total * months;
  22. }
  23.  
  24. if (type.equals("Middle") && dessert.equals("yes")) {
  25. total = 18.99 + 4.35;
  26. totalSumForMonths = total * months;
  27. } else if (type.equals("Middle") && dessert.equals("no")) {
  28. total = 18.99;
  29. totalSumForMonths = total * months;
  30. }
  31.  
  32. if (type.equals("Large") && dessert.equals("yes")) {
  33. total = 25.98 + 4.35;
  34. totalSumForMonths = total * months;
  35. } else if (type.equals("Large") && dessert.equals("no")) {
  36. total = 25.98;
  37. totalSumForMonths = total * months;
  38. }
  39.  
  40. if (type.equals("ExtraLarge") && dessert.equals("yes")) {
  41. total = 35.99 + 3.85;
  42. totalSumForMonths = total * months;
  43. } else if (type.equals("ExtraLarge") && dessert.equals("no")) {
  44. total = 35.99;
  45. totalSumForMonths = total * months;
  46. }
  47. break;
  48.  
  49. case "two":
  50. if (type.equals("Small") && dessert.equals("yes")) {
  51. total = (8.58 + 5.5);
  52. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  53. } else if (type.equals("Small") && dessert.equals("no")) {
  54. total = 8.58;
  55. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  56. }
  57.  
  58. if (type.equals("Middle") && dessert.equals("yes")) {
  59. total = 17.09 + 4.35;
  60. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  61. } else if (type.equals("Middle") && dessert.equals("no")) {
  62. total = 17.09;
  63. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  64. }
  65.  
  66. if (type.equals("Large") && dessert.equals("yes")) {
  67. total = 23.59 + 4.35;
  68. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  69. } else if (type.equals("Large") && dessert.equals("no")) {
  70. total = 23.59;
  71. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  72. }
  73.  
  74. if (type.equals("ExtraLarge") && dessert.equals("yes")) {
  75. total = 31.79 + 3.85;
  76. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  77. } else if (type.equals("ExtraLarge") && dessert.equals("no")) {
  78. total = 31.79;
  79. totalSumForMonths = (total * months) - ((total * months) * (3.75 / 100));
  80. }
  81. break;
  82. }
  83. System.out.printf("%.2f lv.", totalSumForMonths);
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement