subject

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: instance, the file could contain: james 1ben 2suri 1sarah 1jane should include the following methods in your train class:
a method returning the percentage of passengers traveling in first class
a method taking two parameters representing the price of traveling in first and second class and returning the total revenue for the train
a method checking if a certain person is on the train; if he/she is, the method returns true; otherwise, it returns false

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:20
Write the pseudocode for the following: a function called fahrenheittocelsius that accepts a real fahrenheit temperature, performs the conversion, and returns the real celsius temperature. a function called celsiustofahrenheit that accepts a real celsius temperature, performs the conversion, and returns the real fahrenheit temperature. a main module that asks user to enter a fahrenheit temperature, calls the fahrenheittocelsius function, and displays the celsius temperature with a user-friendly message. it then asks the user to enter a celsius temperature, calls the celsiustofahrenheit function, and displays the fahrenheit temperature with a user-friendly message.
Answers: 1
question
Computers and Technology, 22.06.2019 16:00
Why should characters such as / \ " ' * ; - ? [ ] ( ) ~ ! $ { } < > # @ & | space, tab, and newline be avoided in file names?
Answers: 2
question
Computers and Technology, 22.06.2019 20:10
Assume that minutes is an int variable whose value is 0 or positive. write an expression whose value is "undercooked" or "soft-boiled" or "medium-boiled" or "hard-boiled" or "overcooked" based on the value of minutes. in particular: if the value of minutes is less than 2 the expression's value is "undercooked"; 2-4 would be a "soft-boiled", 5-7 would be "medium-boiled", 8-11 would be "hard-boiled" and 12 or more would be a "overcooked".
Answers: 1
question
Computers and Technology, 24.06.2019 09:30
What is the definition of digital literacy?
Answers: 1
You know the right answer?
Design and code a program including the following classes, as well as a client class to test all the...
Questions
question
Mathematics, 04.09.2019 00:10
Questions on the website: 13722367