Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi, I need help with this question. MUST BE IN PYTHON. This is in the section fo

ID: 3730548 • Letter: H

Question

Hi, I need help with this question. MUST BE IN PYTHON. This is in the section for defining functions so it must have a define function and a define main. Program listed as Sales.py

2. (13 Points) Write a program Sales.py that performs the following, · A retail store sale T-shirts. T-shirt cost $8.99 each. Sales tax is 8.5%. .Define a function called totalcost, def totalcost(n), which takes one parameter, the number of T-shirts, calculates and returns the totalcost for purchasing the T shirts (cost of the shirts with tax applied). Call totalcost function in the program to produce a sales table that shows the total cost as shown in the sample output. (No need to take user input) . e (3 pts)Enhancement: The store now has a sale, buy 3 and get 1 free. Define another functions, def salescost(n) to calculate the cost with the sales applied. Ca Il the salescost function in the program to show the sales cost. Sample output: (with enhancement) T-shirt unit price: $ 8.99 Tax rate: 8.50% # of T-shirts Original Cost $ 9.75 19.51 $29.26 $ 39.02 $48.77 $ 58.52 68.28 $78.03 87.79 $97.54 Sales Cost $9.75 $19.51 $29.26 29.26 $39.02 $48.77 $58.52 $58.52 $ 68.28 $78.03 4 5 6 10

Explanation / Answer

def totalcost(n):
t_s_c = 8.99;
s_t = 0.085;
totalcost = n*t_s_c*(1+s_t);
return totalcost;

def salescost(n):
t_s_c = 8.99;
s_t = 0.085;
if(n<=3 and n>0):
return totalcost(n);
elif(n%4==0):
return salescost(n-1);
else:
return salescost(n-1)+totalcost(1);
def main():
print("# of T-shirts Original Cost Sales Cost")
for i in range(1,11,1):
print(" %d $%.2f $%.2f" %(i, totalcost(i) , salescost(i)))

main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote