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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 06:30, jayjay5246
Which option correctly describes a dbms application? a. software used to manage databases b. software used to organize files and folders c. software used to develop specialized images d. software used to create effective presentations
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, abelxoconda
1. which of the following statements are true about routers and routing on the internet. choose two answers. a. protocols ensure that a single path between two computers is established before sending packets over it. b. routers are hierarchical and the "root" router is responsible for communicating to sub-routers the best paths for them to route internet traffic. c. a packet traveling between two computers on the internet may be rerouted many times along the way or even lost or "dropped". d. routers act independently and route packets as they see fit.
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, Alexaisokay1
In which of the following ways can using test-taking tips you? a. you can focus on the information that you need to study. b. you will see the answers to the test. c. you will study more. d. you will be less organized.
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, nataliamontirl4230
Java the manager of a football stadium wants you to write a program that calculates the total ticket sales after each game
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 in other subjects:

Konu
History, 26.02.2020 18:59