Question:
Design a class RailwayTicket with following description:
Instance variables/data members :
String name : To store the name of the customer
String coach : To store the type of coach customer wants to travel
long mobno : To store customerβs mobile number
int amt : To store basic amount of ticket
int totalamt : To store the amount to be paid after updating the original amount
Member methods :
void accept () β To take input for name, coach, mobile number and amount.
void update() β To update the amount as per the coach selected
(extra amount to be added in the amount as follows)
| Type of Coaches | Amount |
|---|---|
| First_AC | 700 |
| Second_AC | 500 |
| Third_AC | 250 |
| sleeper | None |
void display() β To display all details of a customer such as name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.
