Write a program that determines the commission for a sales person's weekly sales. The program will first ask for a sales person's name and then for sales for each day of the week (M-Su)! Then the total will be printed along with the commission. The commission is set at 10%.

Respuesta :

Answer:

# The user is prompt to enter name

name = str(input("Enter the name: "))

# the user is prompt to enter monday sale

mon = int(input("Enter Monday sales: "))

# the user is prompt to enter tuesday sale

tue = int(input("Enter Tuesday sales: "))

# the user is prompt to enter wednesday sales

wed = int(input("Enter Wednesday sales: "))

# the user is prompt to enter thursday sales

thurs = int(input("Enter Thursday sales: "))

# the user is prompt to enter friday sales

fri = int(input("Enter Friday sales: "))

# the user is prompt to enter saturday sales

sat = int(input("Enter Saturday sales: "))

# the user is prompt to enter sunday sales

sun = int(input("Enter Sunday sales: "))

# the total is calculated

total = mon + tue + wed + thurs + fri + sat + sun

# the commission is calculated

commission = (10 * total) / 100

# the total is displayed

print(name, "your total is: ", total)

# the commission is displayed

print(name, "your commission is: ", commission)

Explanation:

The program is written in Python. And the program is well-commented.

Answer:

Find the python script below. Copy and paste directly into your python interpreter. Attached is  also the formatting

Explanation:

def check_number(a):    

   flag = True

   try:

       int(a)

   except ValueError:

       try:

           float(a)

       except ValueError:

           flag = False

           print("wrong input!")

           

   return(flag)

print("Welcome To Weekly Commission Calculator")

name = input("Input your name please and press enter:  ")

check = False

while(check==False):

   day1 = input ("Enter the sales for day 1 and press enter: ")

   check = check_number(day1)  

   continue

check = False

while(check==False):

   day2 = input ("Enter the sales for day 2 and press enter: ")

   check = check_number(day2)  

   continue

check = False

while(check==False):

   day3 = input ("Enter the sales for day 3 and press enter: ")

   check = check_number(day3)  

   continue

check = False

while(check==False):

   day4 = input ("Enter the sales for day 4 and press enter: ")

   check = check_number(day4)  

   continue

check = False

while(check==False):

   day5 = input ("Enter the sales for day 5 and press enter: ")

   check = check_number(day5)  

   continue

check = False

while(check==False):

   day6 = input ("Enter the sales for day 6 and press enter: ")

   check = check_number(day6)  

   continue

check = False

while(check==False):

   day7 = input ("Enter the sales for day 7 and press enter: ")

   check = check_number(day7)  

   continue

Total_sales = float(day1)+float(day2)+float(day3)+float(day4)+float(day5)+float(day6)+float(day7)

#rate = 10%  

rate = 0.1

#commission = rate * Total sales

Commission = rate * Total_sales

print("Total sales is " ,Total_sales)

#print("%s is %d years old." % (name, age))

print("Total sales for %s is $%d and the commission is $%e." % (name, Total_sales,Commission))

Ver imagen olaseye
Ver imagen olaseye
Ver imagen olaseye