
COSC 1336 –
Program 7 – Repetition Structures and Files
Python Programming
Please read till the end before answering!!!
I got the answer but need this to be added.
"Follow these requirements.
Needs percentage applied and Raise the amount of each salary displayed. So that one could be sure of the raised salary.
The total amount of Salary and Total of Raised salary should be displayed at the end."
The trustees of a small college are considering voting a pay raise for their faculty members. They want to grant a 7 percent raise for those earning more than $50,000.00, a 4 percent raise for those earning more than $60,000.00 and 5.5 percent raise for all others. However before doing so, they want to know how much this will cost. Write a program that will print the pay raise for each faculty member, the total amount of the raises, and the average of the raises. Also, print the total faculty payroll before and after the raise. Use the end of file as a sentinel value. The input data is available in program_7.png
Do NOT use any logical operator in the program.
Run your program with the input file, program7.txt
IMPORTANT!!!
Here is the answer which needs to be modified and add
percentage applied and Raise the amount of each salary displayed. So that one could be sure of the raised salary.
The total amount of Salary and Total of Raised salary should be displayed at the end:
def main():
# Variable to count the total Faculty member
totalFaculty = 0
# Variable to count the total raised amount
raiseTotal = 0.0
# Display statement
print("The pay raise for each faculty member is:")
# Display Faculty payroll before and After the raise statement
print("Faculty payroll before \t After the raise")
# Open the file
inFile = open('program7.txt', 'r');
# Read the line
lineRead = inFile.readline()
# While the lineRead is not empty
while lineRead != '':
# Split the words
words = lineRead.split()
# For every word in the words
for word in words:
#get the number
num = float(word)
# For the earning of more than $60,000.00
if (num > 60000):
# Calculate raised salary
salaryRaise = num * 0.04
# For the earning of more than $50,000.00
elif (num > 50000):
# Calculate raised salary
salaryRaise = num * 0.07
# For the other earnings
else:
# Calculate raised salary
salaryRaise = num * 0.055
# Calculate the total raised amount
raiseTotal = raiseTotal + salaryRaise
# Display old and raised salary with 2 decimal format
print(format(num, '.2f'), "\t\t", format((num + salaryRaise), '.2f'))
# Count the total Faculty member
totalFaculty = totalFaculty + 1
# Read the line
lineRead = inFile.readline()
# Close the file
inFile.close()
# Display the total raises amount
print("The total amount of the raises is ", format(raiseTotal, '.2f'))
# Display the average of the raises amount
print("The average of the raises is ", format((raiseTotal / totalFaculty), '.2f'))
# Call the main function.
main()
Use sep='' , ',.2f' where needed.


Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- PYTHON!!! The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment. Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items: The month number (beginning with 1) The current total balance owed The interest owed for that month The amount of principal owed for that month The payment for that month The balance remaining after payment The amount of interest for a month is equal to balance × rate / 12. The amount of principal for a month is equal to the monthly payment minus the interest owed. An example of the program input and output is shown below: Enter the puchase price: 200 (SEE IMAGE FOR PURCHASE PRICE CHART) Results you should get: Input: 200 Output: Purchase price: 200…arrow_forwardTask 2 Use function to calculate Computer Skills. Both skills Yes: show "Sufficient", only one skill: show "Good", no skill: show "Poor" Computer Skills Student ID 521370 811298 780223 528112 427747 207676 158877 154194 480967 962948 701444 803700 268544 975048 204401 846716 127466 621984 285594 826758 972888 739477 857713 339297 249521 868320 872950 198271 702356 726662 365857 136850 492928 850557 987114 776815 666031 904552 161237 268716 Software Skill Yes Yes Yes No Yes Yes No Yes No No Yes No No Yes Yes No No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes No Yes No Yes No Yes No Yes Yes Yes Hardware Skill No Yes Yes No Yes Yes No No Yes No Yes No No No No Yes No No No No Yes Yes Yes Yes No No Yes No Yes No Yes Yes | No Yes Yes Yes No Yes Yes Yesarrow_forwardNeed help PYTHON PROGRAMMING ONLY PLEASE NUMBER 12arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





