200k views
0 votes
Lab 1) Complete the following program to determine the raise and new salary for an employee by adding if ... else statements to compute the raise. The input to the program includes the current annual salary for the employee and a number indicating the performance rating (1=excellent, 2=good, and 3=poor). An employee with a rating of 1 will receive a 6% raise, an employee with a rating of 2 will receive a 4% raise, and one with a rating of 3 will receive a 1.5% raise.

1 Answer

5 votes

Final answer:

To determine the raise and new salary for an employee based on their performance rating, you can use if...else statements. Here is an example of a program that calculates the raise and new salary.

Step-by-step explanation:

To determine the raise and new salary for an employee based on their performance rating, you can use if...else statements. Here is an example of a program that calculates the raise and new salary:

current_salary = float(input('Enter the current annual salary: '))
performance_rating = int(input('Enter the performance rating (1=excellent, 2=good, 3=poor): '))

if performance_rating == 1:
raise_percentage = 6
elif performance_rating == 2:
raise_percentage = 4
else:
raise_percentage = 1.5

raise_amount = current_salary * (raise_percentage / 100)
new_salary = current_salary + raise_amount

print('The raise amount: $', raise_amount)
print('The new salary: $', new_salary)

In this program, the user is prompted to enter the current annual salary and performance rating. The if...else statements determine the raise percentage based on the rating. Finally, the raise amount and new salary are calculated and displayed.

User Zay Lau
by
7.3k points