Amy has packed her bags and is all pumped up to visit Goa with her bffs.
(On the day of travel)
Amy's friend Penny has dropped a bomb. She informed that she wouldn't be able to make it to the trip as her dog was ill. Now, Amy is all furious & has canceled the plan. She had been dreaming of all the fun & partying. Alas the trip got canceled.
(A few days later)
All this while, Amy hasn't spoken to any of her friends. She's still furious, not because the trip got canceled, but because she has spent almost a week planning it right from travel, hotel bookings, to the entire experience.
She then decided to make a simple application that could help every Goa dreamer make a plan quickly unlike her. Can you volunteer & help her out & calm her down?
Fork this repo
Clone this repo
Practice Java basics - operators, conditions, loops, class and object
Upon completion, run the following commands:
git add .
git commit -m "ProGrad ID"
git push origin master
And finally, create a pull request so your ProGrad Mentor (PM) can review your work.
- Do not modify the entire code
- Edit the code as per the instructions.
- Go to Java Resources -> src folder.
- You will have 3 packages src/controller, src/model and src/service.
- Create appropirate Classes inside the specified package as per the instructions given.
- Once the progressions are completed, follow the instructions to run the application and test your code.
- Right click on the project.
- Go to Run as -> Run on server.
- You can check the output in eclipse browser or in your browser.
- Uncomment the codes in each controller to run the project.
- Inputs are defined in each progression
- Output would be the user details and total fare
- Create a parent class called Flight inside the model package with the following arguments
- private int noOfPersons
- private String classType
- private int rates
- private LocalDate from
- private LocalDate to
- private String triptype
- Generate appropriate getters and setters.
- Generate the constructor Flight(int noOfPersons, int rates, LocalDate from,LocalDate to,String triptype) in Flight class.
- Create a parent class called Hotel inside the model package with the following arguments
- private int noOfPersons
- private String roomType
- private int rates
- private String occupancy
- private LocalDate fromdate
- private LocalDate todate
- private int noOfPersons
- Generate appropriate getters and setters.
- Generate the constructor Hotel(int noOfPersons, String roomType, int rates,String occupancy,LocalDate fromdate,LocalDate todate) Hotel class.
- Create a parent class called Train inside the model package with the following arguments
- private int noOfPersons
- private String berth
- private int rates
- private LocalDate date
- private int noOfPersons
- Generate appropriate getters and setters.
- Generate the constructor Train(int noOfPersons, int rates, String berth, LocalDate date) in Train class.
- Create a parent class called Bus inside the model package with the following arguments
- private int noOfPersons
- private String busType
- private int rates
- private LocalDate date
- private int noOfPersons
- Generate appropriate getters and setters.
- Generate the constructor Bus(int noOfPersons, int rates, String busType, LocalDate date) in Bus class.
- Create a class called as Booking inside the service package.
- Create a method public double booking(int noOfPersons,int rates).
- The booking method should return the total rate.
- Create a class called as FareCalculator.
- FareCalculator should extend the Booking Class and should use the booking method defined in Booking Class.
- FareCalculator has 4 methods as mentioned below.
- public double book(Hotel hotel)
- public double book(Flight flight)
- public double book(Train train)
- public double book(Bus bus)
- Each method should return the total fare
- In the public double book(Hotel hotel)method inside the FareCalculator.
- Check-In date should be less than Check-Out date.
- Single occupancy can be given only for 1 guest.
- If there are 3 guests then the rooms alloted should be 1 Double Occupancy room and 1 Single Occupancy.
- Calculate the total fare after these conditions are met.
- In public double book(Flight flight) method inside the FareCalculator.
- If one way trip is selected then departure date is not considered for fare calculation.
- For round trips Start date should be less than return date.
Happy Coding ProGrad ❤️