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 3 – Calculating Monthly Expenses Imagine you are the IT manager for Site 3 that had annual IT expenses of $42,500. Your site was above the target of $35,500 and you want to review your monthly expenses for each month of that year to determine in what months the over-expenditure occurred.
Write a python program that:
Calculates what the monthly target would be for each of the 12 months (assuming that the target is the same each month).
Assigns the monthly target value to a variable called monthly_target.
Uses a For Loop to ask for the input of monthly expenditures for 12 months (make sure your total monthly expenditures add to the $42,500 annual expense).
Compares the expense to the monthly target and uses an if statement to determine if the expense is Over, Under, or Exact to the monthly target for each entry.
Creates a three-column display showing the month and the expense entered for that month and a third column that says Over, Under, or Exact
Code:
yearly_target = 35000
year_expense = 45000
#calculating monthly target
monthly_target = yearly_target/12
print("Monthly Target: ",monthly_target)
monthly_expenses = []
status = []
sum = 0
#reading monthly expenses
for i in range(12):
expense = int(input('Enter expenses for month'+str(i+1)+":
"))
sum = sum + expense
monthly_expenses.append(expense)
#comparing the expense to the monthly target
if expense >= monthly_target:
if expense > monthly_target:
status.append("Over")
else:
status.append("Exact")
else:
status.append("Under")
print("Display of monthly expenses:")
print("Month\tExpense\t\tUsage")
for i in range(12):
print(i+1,monthly_expenses[i],status[i],sep='\t\t')
#To check if monthly expenses entered matched the yearly
expense
print("Sum of Expenses entered: ",sum)
if(sum==year_expense):
print("Validated")
else:
print("Not validated")
Output:
Here's an example Python program that meets the requirements:
# Set the annual IT expenditure target
annual_target = 35000
# Calculate the monthly target
monthly_target = annual_target / 12
# Set the monthly expenditures list
monthly_expenses = []
# Use a for loop to get the input for each month's expenditure
for month in range(1, 13):
while True:
try:
expense = float(input(f"Enter the IT expenditure for month {month}: "))
break
except ValueError:
print("Invalid input. Please enter a valid number.")
monthly_expenses.append(expense)
# Print the table header
print("{:<10}{:<15}{:<10}".format("Month", "Expense", "Result"))
print("="*35)
# Use a for loop to compare each month's expenditure to the monthly target
for month, expense in enumerate(monthly_expenses, 1):
if expense > monthly_target:
result = "Over"
elif expense < monthly_target:
result = "Under"
else:
result = "Exact"
# Print the month, expense, and result for each entry
print("{:<10}${:<15.2f}{:<10}".format(month, expense, result))
Assume you are the CIO of an organization with three different IT department locations with separate...
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 3 – Calculating Monthly Expenses Imagine you are the IT manager for Site 3 that had annual IT expenses of $42,500. Your site was above the target of $35,500 and...
Your program will ask the user to enter the amount of money they want to borrow, the interest rate, and the monthly payment amount. Your program will then determine how many months it will take to pay off that loan, what the final payment amount will be, and how much interest was paid over that time. If the monthly payment amount isn't high enough to pay off more than one month's interest, your program should notify the user what the...
<!DOCTYPE html> <html> <body> <!-- replace the text below with your name!--> <!-- --> <!-- --> <title> TYPE YOUR NAME HERE</title> <script> // // Write a program that asks the user to enter the amount that he or she has // budgeted for a month. Call a function that uses a loop that prompts the user // to enter each of his or her expenses for the month and keep a running total. // The loop finishes when the user...
Beginning three months from now, you want to be able to withdraw $1,500 each quarter from your bank account to cover college expenses over the next three years. If the account pays .37 percent interest per quarter, how much do you need to have in your bank account today to meet your expense needs over the next three years?
The controller of Sonoma Housewares Inc. instructs you to prepare a monthly cash budget for the next three months. You are presented with the following budget information: May June July Sales $134,000 $159,000 $216,000 Manufacturing costs 56,000 68,000 78,000 Selling and administrative expenses 39,000 43,000 48,000 Capital expenditures _ _ 52,000 The company expects to sell about 12% of its merchandise for cash. Of sales on account, 70% are expected to be collected in the month following the sale and...
Start Smart Preschool operates a not-for-profit moming preschool that operates eight months of the year. The preschool has 180 kids enrolled in its various programs. The preschool's primary expense is payroll Teachers are paid a flat salary each of the eight months as follows: Click the icon to view salary data) Click the loon to view additional information) Requirements 1. Prepare Start Smart Preschool's monthly operating budget. Round all amounts to the nearest dollar 2. Using your answer from Requirement...
We want to track weather conditions during the past year's three-month summer season as has designated each day as either rainy ('R'), cloudy ('C'), or sunny ('S'). Write a program that stores this information in s 3x30 array of characters, where the row indicates the month and the column indicates the day of the month. Note no data is being captured for the 31st of any month. This program will read the data in from a file called RainOrShine.txt. From...
Beginning three months from now, you want to be able to withdraw $2,300 each quarter from your bank account to cover college expenses over the next four years. If the account pays 1.45 percent interest per quarter, how much do you need to have in your bank account today to meet your expense needs over the next four year A. 28,785.91 B. 32,633.32 C. 41,086.02 D. 19,934.56
Beginning three months from now, you want to be able to withdraw $4,900 each quarter from your bank account to cover college expenses. The account pays 1.87 percent interest per quarter. How much do you need to have in your account today to meet your expense needs over the next four years? A. $78,400.00 B. $71,086.02 C. $67,221.04 D. $48,785.91
1 Problem You have graduated and have a great job! You move to Ottawa and decide that you want to start saving to buy a house. As housing prices are very high in the Ottawa, you realize you are going to have to save for several years before you can afford to make the down payment on a house.You are going to determine how long it will take you to save enough money to make the down payment given the...