Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Instructions Please write a simplealgorithmand then code it inpythonfor the following problem: Hurricane Preparedness A program is needed to determine how many gallons of water

Instructions

Please write a simplealgorithmand then code it inpythonfor the following problem:

Hurricane Preparedness

A program is needed to determine how many gallons of water a family will need to have on hand for a hurricane, assuming 1 gallon per person per day. The program must ask the user how many people and how many days reserve will be needed. Display the results back to the user.

Make sure to:

-define a main function

-have header comments

-use variables that are descriptive (declare and initialize them too)

-use a constant to represent the gallons per person per day

-have your algorithm copied into the program as the comments

-introduce your program

-make code readable

-make output user friendly (using blank lines, spacing, and understandable questions)

================================================================

can someone tell me where I went wrong?

"""

Algorithm: 1.)Find out how many people need water 2.)Ask how many days reserve will be needed 3.)Display the results back to the user """ def main(): #Prompt and read the number of persons in the family numberOfPersons = int(input("How many persons are there in the family?")) #Prompt and read the number of days reserve is needed numberOfDays = int(input("How many days the reserve is needed?")) #Compute the water reserve needed waterRequired = numberOfPersons * numberOfDays #Display the result to the user print(" For{}days,a family of {} persons need to have {} gallons of water reserved for a hurricane.",format(numberOfDays, numberOfPersons, waterRequired))

main()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Horngrens Financial and Managerial Accounting

Authors: Tracie L. Nobles, Brenda L. Mattison, Ella Mae Matsumura

4th Edition

978-0133255584

Students also viewed these Programming questions

Question

Incorrect Your answer is incorrect. P(-1.12

Answered: 1 week ago

Question

9-1. What is the purpose of a performance appraisal?

Answered: 1 week ago

Question

9-2. Answer the question, Who should do the appraising?

Answered: 1 week ago

Question

9-3. Discuss the pros and cons of four performance appraisal tools.

Answered: 1 week ago