Sadia Mehrose_INFO6066 Project One - Lifeboats F2023

.docx

School

Fanshawe College *

*We aren’t endorsed by this school

Course

1021

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

5

Uploaded by sadia.meh1234

Report
Course: INFO-6066 Coding for Test Project: Project #1 – Lifeboats Due Date: Oct. 14 th , 2023 at 11:59 pm Submitting: Please see the last page for instructions. Professor: Shelley Lapkowski Student Name: Sadia Mehrose Islam___________________ Student ID#: __1187398_______________________ How will my project be marked? If the program fails to compile, a Mark of 0 will be entered. This project accounts for 10% of your final mark and will be marked as follows: Marks Available What are the Marks Awarded For? Mark Assigned If the program fails to compile, a mark of 0 will be entered. 2 Correctly typed variables are created with good descriptive names to hold the input data 2 User is prompted to enter data and data is successfully read from the keyboard and assigned to the variables 2 Calculation of number of lifeboats needed is correct in all cases 2 Calculations of the number of people rescued and drowned are correct 2 Calculation of number of any additional spaces (extra capacity) is correct and only displayed if the number of people drowned is zero 2 Results are neatly displayed to the user and are complete 1 Program documentation header is present and complete 2 Good coding style including proper indentation and suitable comments 15 Total Fanshawe College Page 1 of 5 INFO-6066
Problem Description: Read Carefully When the Titanic embarked on her maiden voyage on April 10, 1912 there were 2,227 people on board. There were also only 20 lifeboats with an average capacity of about 59 people (maximum capacity was therefore about 20 x 59 = 1,180 people). Obviously it would have been ideal to have enough lifeboats to safely evacuate everyone on board ship! Your task is to write a Java program that will calculate the minimum number of lifeboats required to do this as well as the numbers of people who would be rescued or drowned given the number of available lifeboats. Your program should be flexible enough to work for any ship and size of lifeboat. Specifications: Write a Java program called Lifeboats.java that will do all of the following: 1. Display a title 2. Ask the user to enter the following values: a. The name of the ship (possibly including spaces like HMS Endurance ) b. The number of people on board the ship c. The maximum number of people that can be carried by one lifeboat assuming all the lifeboats on the ship are the same size d. The actual number of lifeboats that are available on board the ship 3. Calculate and display the following results: a. The minimum number of lifeboats required to carry all the people b. The number of people that would be rescued if the available lifeboats were filled (but not beyond the number of people on board the ship) as well as the percentage that this represents of all the people on board c. The number of people that would drown as well as the percentage that this represents of all the people on board d. If nobody drowns, then also display the number of additional people that could be carried by the lifeboats if they were all filled to capacity regardless of whether this number is greater than the number of people on board. Fanshawe College Page 2 of 5 INFO-6066
Sample Output and Calculations : Example 1: If there are 800 people, and each lifeboat can carry 90 people, then we need 9 lifeboats. With 9 lifeboats up to 9 x 90 = 810 people can be carried. Note that 8 lifeboats can only carry 720 people which is not enough! If there are 7 lifeboats available then only 7 x 90 = 630 people will be rescued (100 x 630 / 800 = 78.75%). This means 800 – 630 = 170 people will drown (100 x 170 / 800 = 21.25%). Example 2: If there are 800 people, and each lifeboat can carry 100 people, then we need 8 lifeboats. With 8 lifeboats up to 8 x 100 = 800 people can be rescued. If there are 9 lifeboats available then 9 x 100 = 900 people could be rescued, but there are only 800 people so only 800 will be saved (100%) and nobody drowns (0%). With 9 lifeboats the excess capacity would be 900 – 800 = 100 additional people. Fanshawe College Page 3 of 5 INFO-6066
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help