Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To Do: Implement PassengerOutputTable.cpp. Please note there are many other files, but these files are only used for testing/running your code. You only need to
To Do: Implement PassengerOutputTable.cpp. Please note there are many other files, but these files are only used for testing/running your code. You only need to write the code for PassengerOutputTable.cpp.
\fPassengerOutput Table PassengerOutputTable + PassengerOutputTable( passengers : std::vector ) display prints description and column headers display should create + void setOutputField( Field f ) : void OutputTableRow as needed + void setDescription( std::string description ) : void by the mField value + getOutputField() : Field o Add logic to determine + getDescription() : std::string number of rows needed + display() : void O fill in values to each OutputTableRow + rowCount() : size_t O Call the display + getRow( int index ) : OutputTableRow method of each row mPassengerList : std::vector Calculate sums and - mRows : std::vector percentages of survival for - mField : Field field groupings - mDescription : std::string 9Each row has three data member elds along with corresponding getter and setter operations for each data member. getPercentage( ) should be calculated by dividing together the number of survived by the total. Please also see the sample main( ) provided below that offers some ideas on how to test each of these operations. When a PassengerOutputTable is displayed, it will invoke display( ) on each row OutputTableRow, as diagrammed below in a UML object interaction diagram: :PassengerOutputTable :OutputTableRow display( ) > display( ) VVVV One call to display for each OutputTa bleRow in m Rows Assuming the vector v hold six passengers, two in each class of service with only one of the two surviving, the output table for the following code is shown below: Third Class - 0 / Not Known 0 / 0 List of First Class Died With Fare > 0 Survived/Total % First Class - 0 / 123 Second Class- 0 / Third Class - 0 / 0 Not Known 0 / List of all passengers by class Survived/Total % First Class - 200 / 323 61.9195 Second Class- 119 / 277 42.9603 Third Class - 181 / 709 25. 5289 Not Known 0 / 0 0 List of all passengers by embarcation Survived/Total % Cherbourg- 150 / 270 55 . 5556 Queenstown- 44 / 123 35.7724 Southhampton- 304 / 914 33.2604 Not known- 2/ 2 100 List of all passengers by fare Survived/Total % Not Known- 2 / 18 11.1111 $ 1-$10- 108 / 474 22.7848 $10-$25- 128 / 330 38.7879 $25-$50- 104 / 247 42.1053 >$50- 158 / 240 65.8333 Program ended with exit code: 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started