In: Computer Science
python
Create a file named sales_bonus.py
2. Prompt the user for the amount of sales made, convert to a float, and assign to sales.
3. Prompt the user for number of days missed, covert to an int, and assign to days_missed
4. If the user have more than 3000 of sales and has missed less than or equal to two days of work, assign bonus to 100.
5. Else if the user have more than 3000 of sales or has missed less than or equal to one day of work, assign bonus to 50.
6. Otherwise, assign a bonus of 0.
7. Print out the bonus with two decimal places of precision.
Python code:
#2)asking user for the amount of sales made
sales=float(input("Enter the amount of sales made: "))
#3)asking user the number of days missed
days_missed=int(input("Enter the number of days missed: "))
#5)checking if the user has made sales more than 3000(as mentioned
in question) and days missed is less than 1
#(if sales made is less than 3000 use < after sales)
if(sales>3000 and days_missed<=1):
#assigning bonus as 50
bonus=50
#4)checking if the user has made sales more than 3000 and days
missed is less than or equal to 2
elif(sales>3000 and days_missed<=2):
#assigning bonus as 100
bonus=100
else:
#6)assigning bonus as 0
bonus=0
#7)printing Bonus with 2 decimal position
print("Bonus={:.2f}".format(bonus))
Screenshot:
Input and Output: