DOC PREVIEW
USF CSCI 110 - Algorithms

This preview shows page 1 out of 3 pages.

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

Unformatted text preview:

1AlgorithmsSoftware Development Method1. Specify the problem requirements2. Analyze the problem3. Design the algorithm to solve theproblem4. 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 job5. 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 aproblem• Be as specific as possible – include allsteps• 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 results2#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_RATEto be .0825Variables#ask user for the cost of the itemcost = input("Enter item cost: ")• Prompt the user for the cost of the itemand store the response in the variable costInput#calculate the taxtax = cost*TAX_RATE• Multiply the cost times the tax rate andstore the result in the variable taxCalculation#calculate total costtotal = cost+tax• Add the cost and the tax and store theresult in the variable totalCalculation3#display the resultsprint "Cost: ", costprint "Tax : ", taxprint "Total: ", total• Display the results for the userOutputExercises1. Write the algorithm for a program thattakes as input the number of miles a carhas traveled and the number of gallonsof gas the car has consumed andcalculates the number of miles the carcan travel on one gallon of gasExercises2. Write the program for the algorithm youjust generated using the tax program asa


View Full Document

USF CSCI 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?