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

In Raptor, you right click any component such as Start, Input, etc and Comment.

ID: 3747585 • Letter: I

Question

In Raptor, you right click any component such as Start, Input, etc and Comment. All comment lines will be color-coded Ask the user for a number representing the quantity of a product sold, and the unit cost of an item and calculate and display the cost before application of discount, discount percentage, the actual amount of discount, and the final cost. The imput must be in the order given above. The following table states the discount percentage based on quantity sold 1-19 20-49 50-99 100 or more 30% 40% 50% Check the input amount for the quantity and make sure the input value is not 0 or a negative number. If the input value is invalid, print the error message "TNVALID Quantity" and do not perform any calculations. Once you have a valid imput from the user, perform the computations.

Explanation / Answer

i will code in python 3.7

#here is the code

quantity = int(input('enter quantity')) #input for quantity
rate= int(input('enter rate')) #input for rate

if (quantity<=0): #validation
    print("INVALID")
    exit(0)

if (quantity>=1 and quantity<=19): #first block
    dis=0.80
    actual=quantity*rate
    final=actual*dis
    less=actual-final
    print("discount rate is 20%")
    print ("actual price is "+str(actual))
    print ("discounted price is "+str(final))
    print ("discount is "+str(less))

elif (quantity>=20 and quantity<=49): #2nd block
    dis=0.70
    actual=quantity*rate
    final=actual*dis
    less=actual-final
    print("discount rate is 30%")
    print ("actual price is "+str(actual))
    print ("discounted price is "+str(final))
    print ("discount is "+str(less))   
   
elif (quantity>=50 and quantity<=99): #3rd block
    dis=0.60
    actual=quantity*rate
    final=actual*dis
    less=actual-final
    print("discount rate is 40%")
    print ("actual price is "+str(actual))
    print ("discounted price is "+str(final))
    print ("discount is "+str(less))

elif (quantity>=100): #4th block
    dis=0.50
    actual=quantity*rate
    final=actual*dis
    less=actual-final
    print("discount rate is 50%")
    print ("actual price is "+str(actual))
    print ("discounted price is "+str(final))
    print ("discount is "+str(less))   
   

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