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|
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.
CSKC| Created: 12-Apr-2019 | Updated: 26-Nov-2019|ICSE2018