DOC PREVIEW
USF CS 110 - Algorithms

This preview shows page 1-2-3-4-5 out of 15 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 15 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

AlgorithmsSoftware Development MethodSlide 3Slide 4Calculate Tax on an ItemPowerPoint PresentationSlide 7HeadingVariablesInputCalculationSlide 12OutputExercisesSlide 15AlgorithmsSoftware Development Method1. Specify the problem requirements2. Analyze the problem3. Design the algorithm to solve the problem4. Implement the algorithm5. Test and verify the completed program6. Maintain and update the programSoftware Development Method1. Specify the problem requirements •In this class, often done for you2. Analyze the problem•Your job – what are the inputs and outputs3. Design the algorithm to solve the problem•Your job – write it down and turn it in!4. Implement the algorithm•Your job 5. Test and verify the completed program•Your job – this is the most time consuming part•Go back to step 4 if your program fails the tests6. Maintain and update the program•Always assume you will reuse your code at some pointAlgorithms•Step-by-step procedure for solving a problem•Be as specific as possible – include all steps•Example – doing your laundryCalculate Tax on an Item•Problem•Analysis•Algorithm design•Implementation•Testing•Maintenance#A program to calculate tax and total cost for an item.#determine rate of taxation#ask user for the cost of the item#calculate the tax#calculate total cost#display the results#Name: Sami Rollins#A program to calculate tax and total cost for an item.#determine rate of taxationTAX_RATE = .0825#ask user for the cost of the itemcost = input("Enter item cost: ")#calculate the taxtax = cost*TAX_RATE#calculate total costtotal = cost+tax#display the resultsprint "Cost: ", costprint "Tax : ", taxprint "Total: ", total#Name: Sami Rollins#A program to calculate tax and total cost for an item.•Indicates what the program does•Comments–# to the end of the lineHeading#determine rate of taxationTAX_RATE = .0825•Sets the value of the variable TAX_RATE to be .0825Variables#ask user for the cost of the itemcost = input("Enter item cost: ")•Prompt the user for the cost of the item and store the response in the variable costInput#calculate the taxtax = cost*TAX_RATE•Multiply the cost times the tax rate and store the result in the variable taxCalculation#calculate total costtotal = cost+tax•Add the cost and the tax and store the result in the variable totalCalculation#display the resultsprint "Cost: ", costprint "Tax : ", taxprint "Total: ", total•Display the results for the userOutputExercises1. Write the algorithm for a program that takes as input the number of miles a car has traveled and the number of gallons of gas the car has consumed and calculates the number of miles the car can travel on one gallon of gas.Exercises2. Write the program for the algorithm you just generated using the tax program as a


View Full Document

USF CS 110 - Algorithms

Download Algorithms
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Algorithms and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Algorithms 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?