A high school senior is applying for colleges. He wants a program to calculate the out-of-pocket cost for attending each college he is applying. The out-of-pocket cost is determined by the following formula:
Out-of-pocket cost = tuition + room + board + other expenses - financial aid
Write a program to calculate the out-of-pocket cost of every college he is applying. After each college, ask the user whether to calculate cost for another college. Enter 'y' for yes. The following is an example:
Enter name of college: Wake Tech
Enter tuition: 8500
Enter room: 6000
Enter board: 4000
Enter other expenses: 3000
Enter financial aid: 2000
Out-of-pocket cost for this college: 19500
Calculate cost for another college? [y/n] y
Enter name of college: Jefferson College
Enter tuition: 35000
Enter room: 7000
Enter board: 4500
Enter other expenses: 5000
Enter financial aid: 22000
Out-of-pocket cost for this college: 29500
Calculate cost for another college? [y/n] y
Enter name of college: Freedom University
Enter tuition: 20000
Enter room: 10000
Enter board: 5000
Enter other expenses: 5000
Enter financial aid: 30000
Out-of-pocket cost for this college: 10000
Calculate cost for another college? [y/n] n
Save your Python program in a file named Lab04P1.py. Submit the file to Blackboard for credit.
Problem 2
We wrote the following program to calculate BTU needed to cool a room.
roomLength = float(input('Enter room length: '))
roomWidth = float(input('Enter room width: '))
roomHeight = float(input('Enter room height: '))
roomVolume = roomLength * roomWidth * roomHeight
btuNeeded = roomVolume * 3.5
print('BTU needed for this room:', btuNeeded)
Modify the program by adding error checking loops. Room length, width and height must all be greater than 0. Every time the user enters a negative number, display an error message and ask the user to re-enter a valid value immediately.