Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scenario (use for each exercise) Assume you are the CIO of an organization with three different IT department locations with separate costs. You want a

Scenario (use for each exercise)

Assume you are the CIO of an organization with three different IT department locations with separate costs. You want a program to perform simple IT expenditure calculations. Your IT expenditure target is $35,000 per site.

Site expenditures: Site 1 $35,000. Site 2 $37,500. Site 3 $42,500

Exercise 2: Using the "While Loop" Write a PYTHON program that uses a while loop to accomplish the same calculations as in Exercise 1. The program should capture your input values and assign the values to a variable. Use the same target value as in Exercise 1.

Hints: Define a variable called continue_loop and assign it the value of "Y". Define a variable called "target" and assign it the value of 35500.

Your PYTHON program should:

Use a while loop.

Prompt a user to input a site's expenditure and upon hitting the return key:

Ask if they want to add another expenditure with the options of "Y" or "N" (as long as the "continue_loop" variable is equal to "Y"). (Hint: The loop should end if the user input is anything but "Y").

Validate that the data entered is not below zero (review Chapter 4, Program 4-16 to see an example of input validation). If the value is below 0, present a message that says "Values must be greater than 0."

Calculate the average IT expenditure.

Display the average IT expenditure.

Compare that value to the target.

Display one of the following messages: "This site is meeting the organizations target goals!" if the average is equal to or below the target.

"This site is NOT meeting the organization's target goals" if it is above the average.

Save and run the program and take a screenshot of your code and the results of running the program after all inputs have been made.

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions