Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design, implement and test a Java application that will read a file containing data related to the passengers on th e Titanic. The description of

Design, implement and test a Java application that will read a file containing data related to the passengers on th e Titanic. The description of the file is shown below. The application should provide statistical results on the passengers including: a. Total number of passengers on the Titanic b. Percentage of p assengers who perished on the Titanic c. P ercentage of Passen gers who survived the sinking of the Titanic d. P ercentage p assengers who survived the sinking of the Titanic as a function of the passenger class ( e.g. 1,2,3) e. A list of the names of passengers who were less tha n 10 years old who perished on the Titanic f. The count of the number of passengers as a function of the first letter of their last name. (e.g., A: 13, B:33 ...) g. At least one a dditional statistical results you add to enhance the functionality The following are some design criteria and specific requirements that need to be addressed : a. Use command line arguments to send in the name of the Titanic file . b. Use a 2D array to store the Titanic data. (Hint: You will probably need to store the array as String values and then convert to other types as needed since some data is null) c. You should create at least 2 Java classes Titanic and TestTitanic. You are welcome to create additional classes if you want to further separate the functionality. d. You should create separate methods for each of the required functionality. (e.g. getTotalPassengers() will return the t otal number of passengers on the Titanic . ) e. A user - friendly and well - organized menu should be used for users to select which data to return. A sample menu is shown in run examp le. You are free to enhance your design and you should add additional menu items and functionality. f. The menu system should be displayed at the command prompt, and continue to re display after results are returned or until Q is selected. If a user enters an invalid menu item, the system should re display the menu with a prompt asking them to enter a valid menu selection g. The application should keep track of the elapsed time (in seconds) between once the application starts and when the user quits the program. Af ter the program is exited, the application should provide a prompt thanking the user for trying the Titanic program and providing the total time elapsed. Here is sample run:

java TestTitanic Titanic.txt 2

********** Welcome to the Titanic Statistical Applica tion **************************

Enter the number of the question you want answered. Enter Q to quit the program :

1. How many passengers were on the Titanic?

2. What percentage of passengers perished on the Titanic?

3. What percentage passengers survived the sinking of the Titanic?

4. What percentage of passengers survived for each of the three classes?

5. What specific passengers who were less than 10 years old survived the sinking of the titanic?

6. For each letter in the alphabet, how many passengers last names started with that letter?

Q. Quit the program

Enter your selection: 1

There were 1310 Passengers on the Titanic.

Enter the number of the question you want answered. Enter Q to quit the program :

1. How many passengers were on the Titanic?

2. What percentage of passengers perished on the Titanic?

3. What percentage passengers survived the sinking of the Titanic?

4. What percentage of passengers survived for each of the three classes?

5. What specific passengers who were less than 10 years old survived the sinking of the titanic?

6. For each letter in the alphabet, how many passen gers last names started with that letter?

Q. Quit the program

Enter your selection: Q

Thank you for trying the Titanic Program. Elapsed time in seconds was: 95

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago