Presentation is loading. Please wait.

Presentation is loading. Please wait.

Program Options: 10 Minutes online

Similar presentations


Presentation on theme: "Program Options: 10 Minutes online"— Presentation transcript:

1 Program Options: 10 Minutes online
Write a program that will display your home address as it would on an envelope. First Name Last Name Address City, State Zip Code Push: Let the user enter some or all of the information, and have your program format it. 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 Here is a sample website 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. Push: Use the Pascal tutorial to add color etc.

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

3 Goals Improve in your ability to execute a dry run.
See how to let Pascal do the math. Go through pseudo code for the second programming assignment Give second programming assignment

4 Review: What do you recall about…?
Program review; Var X:real; Y:integer; begin Writeln(‘Hello world.’); x:= ; Y:= 10; Writeln(y); Writeln(‘Hello’, y); Writeln(‘World’, x:10:2); readln; End.

5

6 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);

7 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))

8 Translate to Pascal Math Pascal 2(a+c) Ans:=2*(a+c); 3x + 5y
½(b1 + b2)(h) |z-x|

9 Fix it! Open this program from the class website.
Save it into your CS1 folder. Fix it Turn it in as yourNameFix9-15

10 What Math Operations do you recall?
+ - * / () Sqrt() Sqr() Abs()

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

12 Sample program Input: The radius and height of a cylinder. Process:
Surface area = 2πr2+2 πrh Volume = πr2h Output: The Volume and surface area of the cylinder.

13 Hands on Test: Radius of 1 inch and height of 1 inch
Surface area = πr2 + πr2 +2 πrh Volume = πr2h Test: Radius of 1 inch and height of 1 inch Radius of 2 inches and height of 10 inches

14 Pseudo Code Describe what we did to solve this.

15 Dry Run Test the pseudo code

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

17 Program options Write a program for one of the following
Volume and surface area of cylinder (YourNameCylinder) Input: The radius and height of a cylinder. Process: Surface area = πr2 + πr2 +2 πrh Volume = πr2h Output: The Volume and surface area of the cylinder. Write a program to calculate the volume of a spherical cap. Include the needed inputs. (YourNameSphere) a = radius of the cap r = radius of the sphere h = height of the cap

18 Write a second program for one of the following


Download ppt "Program Options: 10 Minutes online"

Similar presentations


Ads by Google