Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3) Develop a java application to implement the following. Create a super class called RedBus which has attributes like BusName, BusNumber, source, destination, no.of seats,
3) Develop a java application to implement the following. Create a super class called RedBus which has attributes like BusName, BusNumber, source, destination, no.of seats, and cost. Make sure, you initialise the basicCost for particular destination. Use the constructors to set the details. Derive two sub classes such as Ordinary and Volvo. Add methods in such as Check_SeatAvailablity, Book Ticket. The Ordinary Bus has three categories Seater, Sleeper. The Volvo Bus has sleeper, Semi Sleeper and Seater. Implement the services to check seatAvailablity(), bookTicket(), computeCost(). While booking, if the chosen bus is ordinary, and for Seater, the cost is equal to the baseCost, for sleeper it is baseCost + 30% of baseCost. Override the computeCost() method in the Volvo class, and calculate the cost accordingly. For Seeter it is baseCost + 50% of baseCost. For Semi sleeper, it is baseCost+90% of the baseCost, For Sleeper, it is baseCost+110% of the baseCost. Calculate the cost and confirm the booking details completely. Demonstrate with appropriate menu based application
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started