(/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

Hire Me
(5/5)

# This program should let the user enter any number of items into the program and then calculate and output the Subtotal

INSTRUCTIONS TO CANDIDATES

Shipping Program

This program should let the user enter any number of items into the program and then calculate and output the Subtotal, Tax (if CA), Shipping and Handling, and Total Due. I used 5 Functions. MUST DO's: Use 5 functions. Error Check State abbreviations and y/n. Create and append to a List for user input. Use 0 in quantity to stop entering items. Iterate over list when doing calculations. Ask to run the program again. Yes/No Loop Format output so Numbers are right aligned. ++++++++++++++++++++++++++++++++++++++++++++++

Sales Tax is only calculated for California. The Tax Rate is 8%. salesTax = subTotal * .08 Calculate shipping using the Total Weight of everything. Shipping is 25 cents per pound. shippingCost = boxWeight * .25 Handling is a value assignment based on the Total Weight of everything. If the Total Weight is less than 10 pounds, Handling is 1 dollar. If the Total Weight is more than 100 pounds, Handling is 5 dollars. If the Total Weight is 10 to 100 pounds,

Handling is 3 dollars. Use an if/elif/else statement to assign a value to the handling variable. Shipping and Handling is calculated by adding the shipping cost to the handling cost. Hints: For the get product information loop, use the GPA Calculator as a guide. Don't use an empty string to exit the loop since our quantity input is an integer, use 0 instead. You will be appending to a list every time the loop runs. This list will have 3 things for each item: quantity, itemWeight, and itemCost. return the List Name from the function. You will have to iterate over the list in order pull out the info for each item. Use the: for mainIndex in range(len(listName)): Step by step instructions:

# your name # section number # date # Final Project Create your program description. Remark and create the function for the user greeting. There are only print lines in this function. Remark and create the function for getting and error checking the state abbreviation for tax. Create a list or Tuple of state abbreviations. Remark and write the input line for the state abbreviation. Remark and error check the input for state. Return the variable that contains the state abbreviation. Remark and create the function for getting the product information. We will create a loop to get the itemQuantity, itemWeight, and itemCost and append this information to a list.

This loop will exit if itemQuantity is equal to Zero. This function will return the list we created. Remark and create an empty list [] for the product information. Create a variable to control the input loop. Remark and create the while loop for the input. Remark and get the input for itemQuantity. Write an if / else. If quantity is equal to Zero, change the variable in step b so the loop exits. Else: Remark and create the input line for itemWeight. Remark and create the input line for itemPrice. Remark and append itemQuantity, itemWeight, and itemPrice to the list. Example: productInfoList.append([itemQuantity, itemWeight, itemPrice]) Return the productInfo list. Remark and create the function to do the calculations. You must pass the information from the productInfo list into the function so you will have a list name in the ()

when it is created. def calculate(productInfoList): We must first create to variables for our running totals and set them to equal Zero. Example: boxWeight = 0 subTotal = 0 We must cycle or iterate through the list to extract the information saved and calculate the totalWeight and subTotal. Example: for mainIndex in range(len(productInfoList)): itemQuantity, itemWeight, itemCost = productInfoList[mainIndex] boxWeight = boxWeight + (quantity * itemWeight) subTotal = subTotal + (quantity * itemCost) Remark and calculate the shipping. Do this by multiplying the boxWeight by .25 Remark and assign the shipping cost. Example: if boxWeight < 10: handling = 1 elif boxWeight > 100: handling = 5 else: handling = 3 Add the shipping and handling costs together. We will need to return the subtotal and shipping and handling out of this function. Remark and create a function that asks the user if they would like to run the program again, error checks this input, and returns

True or False so we can control our main program loop. Remark the MAIN section of your code.

# ----------------------Main----------------------

Remark and call the user greeting function. Remark and create a variable to control the main program loop. Remark and create the main program loop. Remark and call the getPoductInfo function. This function will return the productInfoList so we must create a name and use an = on the left. Example: productInfoListMain = getProductInfo() Remark and call the calculate function. This function will return the subtotal and the shipping and Handling, and we must pass the product list info list into it. Example: subtotal, shippingHandling = calculate(productInfoList) Remark and call the function for getting the state. (Step 3) We must save the state abbreviation that is returned from this function into a variable. Remark and write the code to calculate the tax if the state is California. Use an if / else statement. Example: if stateMain == ‘CA’: tax = subTotalMain * .08 else: tax = 0.00

Remark and write the code to calculate the total due. This is the subtotal plus the shipping and handling plus the tax. Remark and write the code to display and format the results. We are going to display our output in two columns and right-align the numbers. We will format our numbers using commas and 2 decimal places. We are displaying the Subtotal, then the Tax, then the Shipping and Handling, and then the Total Due. Example: print(format('Subtotal:', '<25'),

format(subTotalMain, '>10,.2f')) next line Remark and run the function that asks the user if they want to run the program again. We must assign the output of this function to the variable that controls the main program loop. Step 9 Thoroughly test all aspects of your program to make sure everything works correctly! NOTHING!!! YOU ARE DONE!!!!!!!!!!!

(5/5)

## Related Questions

##### . The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

##### . Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

##### . The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

##### . Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

##### . The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

415 Experts Online