Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in python please!! Chapter 4 Loops Problem 1. Budgeted vs. Actual Expenses Write program that asks the user to enter the amount that

Please answer in python please!!

Chapter 4 Loops

Problem 1. Budgeted vs. Actual Expenses

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. When the loop finishes, the program should display the amount that the user is over or under budget.

Design. Use an IPO diagram to design your program. See IPO diagram attached to this assignment.

Code. Write your program in Python using the above steps. Save your program as a .py file with the name yourlastname_Lab4.1.py

Output. Your program should produce correctly labeled output with dollar amounts rounded to 2 decimal places and dollar signs. Sample dialog:

Enter amount budgeted for the month: 500

Enter an amount spent(0 to quit): 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!

Problem 2. Ocean Levels

Assuming the oceans level is currently rising at about 1.8 millimeters per year, create an application that displays the number of millimeters that the ocean will have risen each year for the next 25 years.

Design. Use an IPO diagram to design your program. See IPO diagram attached to this assignment.

Code. Write your program in Python using the above steps. Save your program as a .py file with the name yourlastname_Lab4.2.py

Output. Your program output should look something like this:

Year Rise (in millimeters)

------------------------------------------

1 1.80

2 3.60

3 5.40

4 7.20

5 9.00

6 10.80

7 12.60

8 14.40

9 16.20

10 18.00

11 19.80

12 21.60

13 23.40

14 25.20

15 27.00

16 28.80

17 30.60

18 32.40

19 34.20

20 36.00

21 37.80

22 39.60

23 41.40

24 43.20

25 45.00

Programming Style Requirements.

Comments Begin your program with a comment that includes: a) your name, b)program status either Complete or describe any incomplete or non-functioning part of your program c)A 1-3 line description of what the program does.

Variable names use meaningful variable names such as total_taxes or num_cookies.

Named constants Use named constants for all number values that will not be changed in the program such as RECIPE_SUGAR = 1.5. See section 2.9 on Named Constants

You will have two .py files and one IPO file to turn in to Blackboard.

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

Graph Databases New Opportunities For Connected Data

Authors: Ian Robinson, Jim Webber, Emil Eifrem

2nd Edition

1491930896, 978-1491930892

More Books

Students also viewed these Databases questions

Question

What is the relationship between diversity, inclusion, and equity?

Answered: 1 week ago