Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review Dry Run Taking Names Online time Math is Good

Similar presentations


Presentation on theme: "Review Dry Run Taking Names Online time Math is Good"— Presentation transcript:

1 Review Dry Run Taking Names Online time Math is Good
Intro to Programming Review Dry Run Taking Names Online time Math is Good

2 Learning Objectives Review: What makes a good variable.
Be able to Dry run a program that includes math operations and output Understand how input names into a program. Be able to develop a program in Pascal. If time. A little more math review and a letting Pascal do the math for you.

3 Which are valid variable names? Which are good variable names?
Yo 3daysleft Summer time X Q Top Score Address Begin Writeln End X1 X^2 What? Number from 1 to 13 and write valid/invalid and good/bad.

4 Dry run 1 (What do you think the following program does?)
{Mr. Smith's Sample Program} {Dry Run #2} { } program DryRunTest; uses crt; var a,b,c:integer; begin clrscr; a:= 20; b:= 16; c:= a+b; writeln(a, b, c); b:= c – 2*(a+b) -6; a:= c + b; end. Dry run 1 (What do you think the following program does?)

5 Getting Names Program sample2; var begin end. name:string;
writeln(‘Please enter your name.’); readln(name); writeln(‘Hello ‘, name,’ welcome back!’); readln; end.

6 Your program Write a program that will display your home address as it would on an envelope. Push: Let the user enter some or all of the information, and have your program format it. Write a program that shows a poem or song. Can be an original work. Include space as appropriate. Push: Look up for..do, or repeat..until to have your program repeat the song several times. Write a mad-lib program Have the user enter at least 4 pieces of information. Noun, Adverb (honestly), Adjective (messy), Verb, Geographical location, … The computer will generate the mad-lib

7 Math Math Pascal Code Example + Ans:= first+second; -
Ans:= second – first; x * Ans := first * second; ÷ / Ans := first / second () Ans := (first + 2)/second; π PI Ans := PI; 52 sqr Ans := sqr(first); Sqrt() Ans:= sqrt(first);

8 You turn: What is the result of the following?
Expression Answer Type 2+ 12 5*(8-15) 5 + 6*3 6 + 4/2 – 8 (6+4)/2 – 8 (6+4)/(2-8) Sqrt(9) Sqrt(4*4 + 9) Sqrt(sqr(3) + sqr(4))

9 Fix the following Fix5-20.pas in the assignments folder
Open it in Pascal, save it to your documents then fix it. Fix the following prograhm Fix it 1 {Finding the average of two numbers) Number1, number 2, The average:integers. start writeln("Please enter two numbers) readline(17, 13) number1+number2/2 = average Show The average of 17 and 13 is average stop

10 Write a program for one of the following
Extension: Look up If..then to check if the sides entered actually do make a triangle.


Download ppt "Review Dry Run Taking Names Online time Math is Good"

Similar presentations


Ads by Google