Question: Design a class In java RailwayTicket with following description:Instance variables / data members:String nameTo store the name of the customerString coachTo store the type of
Design a class In java RailwayTicket with following description:Instance variablesdata members:String nameTo store the name of the customerString coachTo store the type of coach customer wants to travellong mobnoTo store customer s mobile numberint amtTo store basic amount of ticketint totalamtTo store the amount to be paid after updating the original amountMember methods:void accept void updateTo take input for name, coach, mobile number and amount.To update the amount as per the coach selected extra amount to be added in the amount as followsType of CoachesAmountFirst ACSecond ACThird ACSleeperNone To display all details of a customer such as name, coach, total amount and mobile number.void displayWrite a main method to create an object of the class and all the above member methods.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
