Design a class railway ticket with following description:.

Problem Statement - Class Design – Railway Ticket
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 Nonevoid 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. 


sleeper Nonevoid 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. 

Solution


Embedding an online compiler into a website

Post a Comment

Please Select Embedded Mode To Show The Comment System.*

Previous Post Next Post

It looks like you're using an ad blocker. We rely on ads to keep our site free, please whitelist us!

Click here to continue

Please whitelist our site to continue enjoying our content.

Whitelist | Close