Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem I: Ocean Levels Goal: Assuming the ocean s level is currently rising at about 1 . 2 millimeters per year, create a program that

Problem I: Ocean Levels
Goal: Assuming the oceans level is currently rising at about 1.2 millimeters per year, create a program that
displays the number of millimeters that the ocean will have risen each year for the next 30 years.
Design: You will be using an IPO diagram to design your program. Under INPUTS, list
everything the program will need to produce the result. Under OUTPUTS, list what the program is going to
produce. Under PROCESSING, list the detailed pseudocode steps needed to produce the programs output.
This includes formulas your program will need.
Output: Your program output should look something like this (the values listed in the Rise column below
may not be real):
Year Rise (in millimeters)
------------------------------------------
11.80
23.60
35.40
47.20
59.00
610.80
712.60
814.40
916.20
1018.00
1119.80
1221.60
1323.40
1425.20
1527.00
1628.80
1730.60
1832.40
1934.20
2036.00
2137.80
2239.60
2341.40
2443.20
2545.00
2646.80
2748.60
2850.40
2952.20
3054.00
Requirements:
Use named constants for all number values that will not be changed in the program
Use F-strings
Problem II: Budgeted vs. Actual Expenses
Goal: Write program that asks the user to enter the amount that he or she has budgeted for a month. Using a while loop, the user should be prompted to enter each of his or her expenses for the month and keep a running total. The loop should finish when the user enters 0. When the loop finishes, the program should display the amount that the user is over budget (if any).
Design: You will be using an IPO diagram to design your program. Under INPUTS, list
everything the program will need to produce the result. Under OUTPUTS, list what the program is going to
produce. Under PROCESSING, list the detailed pseudocode steps needed to produce the programs output.
Input Validation: The amount budgeted for a month must be a positive number; use a while loop to validate the input (see example in section 4.6). An expense must be a non-negative number; use a while loop to validate the input. All decimal values must be rounded to two decimal places.
Output and Sample Dialog:
Enter amount budgeted for the month: 0
Enter a positive amount: -60
Enter a positive amount: -5
Enter a positive amount: 500
Enter an amount spent (0 to quit): -20
Enter a non-negative amount spent: -40
Enter a non-negative amount spent: 50
Enter an amount spent (0 to quit): 75
Enter an amount spent (0 to quit): 800
Enter an amount spent (0 to quit): 23.95
Enter an amount spent(0 to quit): 0
Budgeted: $500.00
Spent: $948.95
You are $448.95 over budget. PLAN BETTER NEXT TIME!
Your program should use F-strings to produce correctly labeled output with dollar amounts rounded to two decimal places and dollar signs.
Requirements:
Use named constants for all number values that will not be changed in the program
Use F-strings

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

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions