Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!