Flow chart and AlgorithmAnnouncementExam Next WednesdayToday’s TopicsProblem SolvingAlgorithmsFour algorithmsProblem to SolveExample of AlgorithmSequence of StepsAlgorithm ExampleMailing a LetterFlowchartsFlowchart ElementsSlide 15Flowchart ChecklistDecimal number to binary number:Decimal number to binary numberPseudo codeElements of pseudo codeExample: Binary2DecimalBinary-ASCII conversionSteps in Binary-ASCIIPre-lab AssignmentFlow chart and AlgorithmAnnouncementExam One–Wednesday October 1st–100 points–Mixture of short answer, problem solving, matching, and maybe a multiple choice questionMonday class will be held as a review session.Exam Next WednesdayHistory of ComputersHardware – inside and outsideSoftware – Microsoft Word, ExcelSpread sheet and dataOperating Systems and Computer SecurityPirates of Silicon ValleyWriting Lab ReportsBinary MathematicsFlowcharts and AlgorithmsToday’s TopicsAlgorithms FlowchartsPseudo codeProblem SolvingFor the rest of the semester, we will practice problem-solving. If you learn nothing else from this class, I would like you to learn to take a good approach to problem solvingAlgorithmsTo solve a problem, you got to figure out how to solve it by yourself.To make a computer solve a problem, you need to you have to tell the computer, step by step, exactly what you want it to do. The computer then "executes" the program, following each step mechanically, to accomplish the end goal. Algorithm: Sequence of step-by-step instructions that will produce a solution to a problemFour algorithmsThe taxi algorithm: –Go to the taxi stand. –Get in a taxi. –Give the driver my address. The call-me algorithm: –When your plane arrives, call my cell phone. –Meet me outside baggage claim. The rent-a-car algorithm: –Take the shuttle to the rental car place. –Rent a car. –Follow the directions to get to my house. The bus algorithm: –Outside baggage claim, catch bus number 70. –Transfer to bus 14 on Main Street. –Get off on Grand River Ave. –Walk two blocks north to my house.Problem to SolveWhat steps would you propose to solve the following problem?–You are dirty and want to clean up–Solution: Take a showerWhat are the steps?Example of AlgorithmTake clothes offTurn on waterStep into showerWash faceWash bodyShampoo hairTurn water offDry offGet dressedProblem:You are dirtySolution:Take a showerHow:Take a ShowerAlgorithmTake a Shower AlgorithmSequence of StepsFairly regular order of events–must take clothes off first–cannot dry off before washingCannot skip steps to complete jobResult orientedTermination of algorithm after resultAlgorithm ExampleDefine the algorithm for mailing a letter, from obtaining the envelope to placing it in the mailboxMailing a LetterObtain EnvelopeIf letter is too big, fold letterPlace letter in envelopeAddress EnvelopeSeal envelopeObtain stampAffix stampPlace in mailboxFlowchartsFlowcharts are graphical and verbal illustrations of algorithmsFlowcharts are useful in describing any step-by-step procedureFlowcharts make it easier to create programming codeFlowchart Elementsread xprint yx = y * xbeginif x > 0start, endinputoutputcomputationcomparisonor decisionSpecific shapes have specific roles in a flowchart ...TFDoAssignment#5Pre-defined process, usually complexFlowchartsobtainenvelopeIs letterbigger thanenvelope?yesfold letterinsert intoenvelopenoaddress envelopeaffix stampplace inmailboxobtain stampendstartsealenveloperaise flagFlowchart ChecklistAll major elements of the algorithm are indicated.The elements are clearly labeled.Sequence of elements is clear and there are no gaps or dead ends.Sequence of elements is logical from user's point of view.Flowchart symbols are used correctly.Decimal number to binary number:Decimal number to binary numberStartGet a numberDivide the NumberBy 2Is the quotient Equal to 1?PrintThe Remainto the left of previous remains NoPrint 1To the left ofPrevious remainsEndYesPseudo codeFlow chart in a text form.More like a computer program, but with human language.Can be easily translated into computer languages.Elements of pseudo codeIF condition is true THENProcess step (1)ELSEProcess step (2)GOTO–Unconditional jumpIf conditionIs true Process Step (1)ProcessStep (2)Example: Binary2Decimal1. Get a number2. IF the number is equal to 1 or 0Print the number; END3. Divide the number by 24. IF quotient is 1 THENPrint 1 to the left of the previous remains5. ELSEPrint the remain to the left of previous remains. GOTO 36. ENDBinary-ASCII conversionEach letter is represented by an 8-bit binary number, called ASCII (American Standard Code for Information Interchange. )Binary to Base TenBase Ten to ASCIIDetails?Steps in Binary-ASCIIInput numberBreak number up into eight bitsCompute base two values for each bitSum base two values to get base ten valueUsing base ten number, look in ASCII chartOutput ASCII characterIs there another number?Repeat procedurePre-lab AssignmentUsing the steps of the Binary-ASCII conversion, create a flowchart, using the proper shapes, arrows, etc.In Friday’s Lab we will use Powerpoint to create flow
View Full Document