Advertisement
ellyeqka

Untitled

Sep 30th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. package first;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class vacation {
  6. public static void main(String[] args) {
  7. Scanner elly = new Scanner(System.in);
  8. int groupOfPeople = Integer.parseInt(elly.nextLine());
  9. String typeGroup = elly.nextLine();
  10. String dayOfWeek = elly.nextLine();
  11. double totalPrice = 0;
  12. double price = 0;
  13. if (dayOfWeek.equalsIgnoreCase("friday")) {
  14. if (typeGroup.equalsIgnoreCase("students")) {
  15. if (groupOfPeople >= 30) {
  16. price = 8.45 * 0.85;
  17. totalPrice = groupOfPeople * price;
  18. } else {
  19. totalPrice = groupOfPeople * 8.45;
  20. }
  21. System.out.printf("Total price: %.2f", totalPrice);
  22. } else if (typeGroup.equalsIgnoreCase("business")) {
  23. if (groupOfPeople >= 100) {
  24. price = 10.90;
  25. totalPrice = groupOfPeople * price - (10 * price);
  26. } else {
  27. totalPrice = groupOfPeople * 10.90;
  28. }
  29. System.out.printf("Total price: %.2f", totalPrice);
  30. } else if (typeGroup.equalsIgnoreCase("regular")) {
  31. if (groupOfPeople >= 10 && groupOfPeople <= 20) {
  32. price = 15 * 0.95;
  33. totalPrice = groupOfPeople * price;
  34. } else {
  35. totalPrice = groupOfPeople * 15;
  36. }
  37. System.out.printf("Total price: %.2f", totalPrice);
  38. }
  39. } if (dayOfWeek.equalsIgnoreCase("saturday")) {
  40. if (typeGroup.equalsIgnoreCase("students")) {
  41. if (groupOfPeople >= 30) {
  42. price = 9.80 * 0.85;
  43. totalPrice = groupOfPeople * price;
  44. } else {
  45. totalPrice = groupOfPeople * 9.80;
  46. }
  47. System.out.printf("Total price: %.2f", totalPrice);
  48. } else if (typeGroup.equalsIgnoreCase("business")) {
  49. if (groupOfPeople >= 100) {
  50. price = 15.60;
  51. totalPrice = groupOfPeople * price - (10 * price);
  52. } else {
  53. totalPrice = groupOfPeople * 15.60;
  54. }
  55. System.out.printf("Total price: %.2f", totalPrice);
  56. } else if (typeGroup.equalsIgnoreCase("regular")) {
  57. if (groupOfPeople >= 10 && groupOfPeople <= 20) {
  58. price = 20 * 0.95;
  59. totalPrice = groupOfPeople * price;
  60. } else {
  61. totalPrice = groupOfPeople * 20;
  62. }
  63. System.out.printf("Total price: %.2f", totalPrice);
  64. }
  65. }if (dayOfWeek.equalsIgnoreCase("sunday")) {
  66. if (typeGroup.equalsIgnoreCase("students")) {
  67. if (groupOfPeople >= 30) {
  68. price = 10.46 * 0.85;
  69. totalPrice = groupOfPeople * price;
  70. } else {
  71. totalPrice = groupOfPeople * 10.46;
  72. }
  73. System.out.printf("Total price: %.2f", totalPrice);
  74. } else if (typeGroup.equalsIgnoreCase("business")) {
  75. if (groupOfPeople >= 100) {
  76. price = 16;
  77. totalPrice = groupOfPeople * price - (10 * price);
  78. } else {
  79. totalPrice = groupOfPeople * 16;
  80. }
  81. System.out.printf("Total price: %.2f", totalPrice);
  82. } else if (typeGroup.equalsIgnoreCase("regular")) {
  83. if (groupOfPeople >= 10 && groupOfPeople <= 20) {
  84. price = 22.50 * 0.95;
  85. totalPrice = groupOfPeople * price;
  86. } else {
  87. totalPrice = groupOfPeople * 22.50;
  88. }
  89. System.out.printf("Total price: %.2f", totalPrice);
  90. }
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement