Question
Directions Complete the following exercises using C programming language. Take screenshots of the code and its output where specified and paste them into in a
Directions
Complete the following exercises using C programming language. Take screenshots of the code and its output where specified and paste them into in a well-labeled Word document for submission.
Scenario
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 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.
- Hint:
- 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 program should:
- Use a while loop.
- Prompt a user to input a sites 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 organization's 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started