Write a program that solves the following problem:

One marker costs 80 cents. A package of five markers costs $3.50. This encourages people to buy complete packages rather than having to break packages open. The tax is 6.5% of the total. The shipping cost is 5% of the total (before tax). Your program will prompt for a number of markers (an integer). It will calculate and display:

⢠The number of complete packages of markers
⢠The number of separate markers (hint: use // and %)
⢠The cost for the markers before shipping and tax
⢠The cost of shipping
⢠The cost of tax
⢠The total cost of the markers after shipping and tax are added (the grand total)

Answer :

RemielUri

Answer:

def main():

   singleMarkerPrice = 0.80

   packageOfMarkersPrice = 3.50

   tax = 0.065

   shipping = 0.050

   userInput = int(input("How many markers do you want? "))

   amountOfPackages = 0

   singleMarkers = 0

   if userInput % 5 == 0:

       amountOfPackages = userInput / 5

   else:

       amountOfPackages = userInput // 5

       singleMarkers = userInput % 5

   # Just for syntax so if the single marker amount is one, it prints package instead of packages

   if amountOfPackages == 1:

       print("You have " + str(int(amountOfPackages)) + " complete package")

   else:

       print("You have " + str(int(amountOfPackages)) + " complete packages")

   # Just for syntax so if the single marker amount is one, it prints marker instead of markers

   if singleMarkers == 1:

       print("You have " + str(int(singleMarkers)) + " single marker")

   else:

       print("You have " + str(int(singleMarkers)) + " single markers")

   totalAmountBeforeTax = (amountOfPackages * packageOfMarkersPrice) + (singleMarkers * singleMarkerPrice)

   print("The total amount before tax comes out to " + str(float(totalAmountBeforeTax)))

   costOfShipping = float(round((totalAmountBeforeTax * shipping), 2))

   costOfTax = float(round((totalAmountBeforeTax * tax), 2))

   print("The cost of shipping is " + str(costOfShipping))

   print("The cost of tax is " + str(costOfTax))

   totalAmount = totalAmountBeforeTax + costOfShipping + costOfTax

   print("The total amount comes out to " + str(round(totalAmount, 2)))

main()

Explanation:

This should be correct. If it isn't let me know so I can fix the code.

Other Questions