In: Computer Science
Salary Raise: At the beginning of every year, you receive a raise on your previous year’s salary.
Raise = Salary * Rate
Create an application that displays the amount of your annual raises and also your new salaries for the next ten years, using raise rates of 1.5%, 2%, 2.5%, 3%, 3.5%, 4%, 4.5%, 5%.
The input for the salary should come from an input box and should only allow a value between 10,000 and 100,000. Use a loop to validate the input.
Program in Python to calculate the raise in salary:
Raise = Salary * Rate
#Program in Python3
#take input
salary = int(input("Enter Salary: \n"))
#declare initial rate
rate = 1.5
#check if salary range is valid
if salary >= 10000 and salary <= 100000:
#run loop 10 times for 10 years
for i in range(10):
print("Raise for year {} is: {}".format(i+1,salary*(rate/100)))
#new salary = old salary + range
salary = salary + salary*(rate/100)
print("New Salary is: ",salary, "\n")
#increment rate of raise
rate = rate +0.5
else:
print("Salary should be between 10,000 and 100,000")
Program Screenshot:
Please refer to the screenshot of the code to understand the indentation of the code:
Program output: