Program using Python.
Teachers in most school districts are paid on a schedule that provides a salary based on their number of years of teaching experience. For example, a beginning teacher in the Lexington School District might be paid $30,000 the first year. For each year of experience after this first year, up to 10 years, the teacher receives a 2% increase over the preceding value.
Write a program that displays a salary schedule, in tabular format, for teachers in a school district. The inputs are the starting salary, the percentage increase, and the number of years in the schedule. Each row in the schedule should contain the year number and the salary for that year.
Expert Answer
Python code:
starting_salary=input(‘enter starting salary: ‘)
percentage_increase=input(‘enter percentage increase of salary: ‘)
no_of_years=input(‘enter number of years in schedule: ‘)
year_number=[] #empty lists used for calculation
salary_for_year=[]
salary_inc=starting_salary
for i in range(1,no_of_years+1):
year_number.append(i) #appending year to year_number list
salary_for_year.append(round(salary_inc,2)) #value rounded to 2 decimal places
salary_inc=salary_inc+(0.01*percentage_increase*salary_inc)
#increasing salary for next year in the loop
print ‘ ________________________________________’
print ‘|’,’t’,’year’,’t’,’|’,’t’,’salary’,’tt’,’|’
print ‘—————————————–‘
for i in range(no_of_years):
print ‘|’,’t’,year_number[i],’t’,’|’,’t’,salary_for_year[i],’t’,’|’
print ‘ ________________________________________’
Output: