Specifications: Write a Java program called LifeRaft.java that will do all of the following: Display a title Ask the...

70.2K

Verified Solution

Question

Programming

Specifications:

Write a Java program called LifeRaft.java that will do all ofthe following:

  1. Display a title
  2. Ask the user to enter the following values:
    1. The type of plane(Boeing 747 or Airbus A300)
    2. The number of passengers on board the Plane
    3. The number of crew aboard the plane
    4. The maximum number of people that can be carried by oneliferaft assuming all the liferafts on the plane are the samesize
    5. The actual number of liferafts that are available on board theplane

  1. Calculate and display the following results:
    1. The minimum number of liferafts required to carry all thepeople
    2. The number of people that would be rescued if the availableliferafts were filled (but not beyond the number of people on boardthe plane) as well as the percentage that this represents of allthe people on board
    3. The number of people that would drown as well as the percentagethat this represents of all the people on board
    4. If nobody drowns, then also display the number of additionalpeople that could be carried by the liferafts if they wereall filled to capacity regardless of whether this numberis greater than the number of people on board.

Example 1:

  • If there are 240 passengers and 8 crew, and each liferaft cancarry 40 people, then we need 7 liferafts. With 7 liferafts, up to7 x 40 = 280 people can be carried. Note that 6 liferafts can onlycarry 240 people, which is not enough!
  • If there are 6 liferafts available then only 6 x 40 = 240people will be rescued (100 x 240 / 248 = 96.77%). This means 248 –240 = 8 people will drown (100 x 8 / 240 = 3.33%).

Example 2:

  • If there are 240 passengers and 8 crew, and each liferaft cancarry 40 people, then we need 7 liferafts. With 7 liferafts up to 7x 40 = 280 people can be rescued.
  • If there are 7 liferafts available then 7 x 40 = 280 peoplecould be rescued, but there are only 248 people so only248 will be saved (100%) and nobody drowns (0%).
  • With 7 liferafts the excess capacity would be 280 – 248 = 32additional people.

Answer & Explanation Solved by verified expert
4.3 Ratings (816 Votes)
LifeRaftjavaimport javautilpublic class LifeRaft public static void mainString args Scanner scnewScannerSystemin String planeType do SystemoutprintEnter type of plane planeTypescnextLine ifplaneTypeequalsAirbus A300 planeTypeequalsBoeing747 break whiletrue SystemoutprintNo    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students