Advertisement
Guest User

Vacation

a guest
May 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. package BasicSyntax;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Vacation {
  6. public static void main(String[] args) {
  7. Scanner scan = new Scanner(System.in);
  8. int people = Integer.parseInt(scan.nextLine());
  9. String group = scan.nextLine();
  10. String day = scan.nextLine();
  11.  
  12. double price = 0.0;
  13.  
  14. if (group.equals("Students")) {
  15. switch (day) {
  16. case "Friday":
  17. price = 8.45;
  18. break;
  19. case "Saturday":
  20. price = 9.80;
  21. break;
  22. case "Sunday":
  23. price = 10.46;
  24. break;
  25. }
  26. if (people >= 30) {
  27. price *= 0.85;
  28. }
  29. } else if (group.equals("Business")) {
  30. switch (day) {
  31. case "Friday":
  32. price = 10.90;
  33. break;
  34. case "Saturday":
  35. price = 15.60;
  36. break;
  37. case "Sunday":
  38. price = 16.00;
  39. break;
  40. }
  41. } else if (group.equals("Regular")) {
  42. switch (day) {
  43. case "Friday":
  44. price = 15.0;
  45. break;
  46. case "Saturday":
  47. price = 20.0;
  48. break;
  49. case "Sunday":
  50. price = 22.50;
  51. break;
  52. }
  53. if (people >= 10 && people <= 20) {
  54. price *= 0.95;
  55. }
  56. }
  57. if (group.equals("Business") && people >= 100) {
  58. price *= (people -10);
  59. System.out.printf("Total price: %.2f", price);
  60. } else {
  61. System.out.printf("Total price: %.2f", price * people);
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement