Design and code a program including the following classes


Design and code a program including the following classes, as well as a client class to test all the methods coded: A Passenger class, encapsulating a passenger. A passenger has two attributes: a name, and a class of service, which will be 1 or 2. A Train class, encapsulating a train of passengers. A train of passengers has one attribute: a list of passengers, which must be represented with an ArrayList. Your constructor will build the list of passengers by reading data from a file called passengers.txt. You can assume that passengers.txt has the following format: ... For instance, the file could contain: James 1 Ben 2 Suri 1 Sarah 1 Jane 2 ... You should include the following methods in your Train class: a. a method returning the percentage of passengers traveling in first class b. a method taking two parameters representing the price of traveling in first and second class and returning the total revenue for the train c. a method checking if a certain person is on the train; if he/she is, the method returns true; otherwise, it returns false Turn in the Passenger class, the Train class, the TrainClient class, and the output. Clamp all into a folder in proper order: project assignment, source and output. Make sure each class has the proper documentation at the top and a documentation.

Solution Preview :

Prepared by a verified Expert
Programming Languages: Design and code a program including the following classes
Reference No:- TGS01677043

Now Priced at $40 (50% Discount)

Recommended (91%)

Rated (4.3/5)