Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 1 9/10/2014 Review Dry Run Math in Pascal How do you start, when you don’t know where to start?

Similar presentations


Presentation on theme: "Computer Science 1 9/10/2014 Review Dry Run Math in Pascal How do you start, when you don’t know where to start?"— Presentation transcript:

1 Computer Science 1 9/10/2014 Review Dry Run Math in Pascal How do you start, when you don’t know where to start?

2 What do you recall about… 1.Uses 2.Crt 3.Dry run 4.Writeln 5.Write 6.Readln 7.End 8.Variable names 9.Real 10.Integer 11.String 12.errors Number your page 1 to 12 and write a brief description for each of the following. Check with your neighbors if you are stuck

3 Warm-up: Dry run the following program dryrun9_15_10; uses crt; begin clrscr; write('To think that'); writeln('two and two are four'); writeln(' and neither five nor three.'); write('The heart of man'); writeln(' has long been sore'); writeln(' and long ''tis like to be.'); readln; end. To dry run it, write down what it shows on the screen in your notebook.

4 Which are valid variable names? Which are good variable names? 1.Yo 2.3daysleft 3.Summer time 4.X 5.Q 6.Top Score 7.Address 8.Begin 9.Writeln 10.End 11.X1 12.X^2 13.What? Number from 1 to 13 and write valid/invalid and good/bad.

5 Goals Warm/ Review See how to let Pascal do the math. Go through pseudo code for the second programming assignment Give second programming assignment

6 Translate the following into Pascal

7 Steps to code Hands on –Doing samples by hand. Pseudo code –Write out instructions in English Dry Run –Testing your instructions Code –Translate the Pseudo-Code to Pascal.

8 Sample program Input: The radius and height of a cylinder. Process: Volume = πr 2 h Output: The Volume of the cylinder.

9 Hands on –Volume = πr 2 h Test: Radius of 1 inch and height of 1 inch Radius of 2 inches and height of 10 inches

10 Pseudo Code Describe what we did to solve this.

11 Dry Run Test the pseudo code

12 Code Translate the Pseudo code to code, Pascal in the case of this class.

13 Program options oWrite a program for one of the following oVolume and surface area of cylinder oInput: The radius and height of a cylinder. oProcess: oSurface area = πr 2 + πr 2 +2 πrh oVolume = πr 2 h oOutput: The Volume and surface area of the cylinder. oWrite a program to calculate the volume of a spherical cap. Include the needed inputs. oa = radius of the cap or = radius of the sphere oh = height of the cap

14 Write a second program for one of the following


Download ppt "Computer Science 1 9/10/2014 Review Dry Run Math in Pascal How do you start, when you don’t know where to start?"

Similar presentations


Ads by Google