Computer Programming - Seton Home Study School · Computer Programming T414 ev 12 Seton ome Stu Soo...

3
Course Manual MAT414_12A Computer Programming Seton Home Study School

Transcript of Computer Programming - Seton Home Study School · Computer Programming T414 ev 12 Seton ome Stu Soo...

Course Manual MAT414_12A

Computer ProgrammingSeton Home Study School

C O M P U T E R P R O G R A M M I N G

Computer Programming (MAT414 Rev.12A) Seton Home Study School Course Lesson Plans | Revised 5/2012 High School10

LESSON 1

To understand what computer programming is.

OBJECTIVE

Sit down at your computer and work through Chapter 1 in the Small Basic text. You have now completed your first computer program.

But what exactly is computer programming? It is simply giving the computer a series of instructions. You give the instructions to the computer, and the computer carries them out. The challenge of computer program-ming is to write the instructions so that the result is what you intend.

Suppose that you want someone to change a light bulb, but they do not know how to do it, and they need a list of instructions. You could write something like:

1. Get a light bulb from the closet 2. Take the burnt-out bulb from the socket 3. Put the new light bulb in the socket

That’s a pretty simple set of instructions. When you think about it, each of those lines really involves several steps, which we could expand. For example, “Take the burnt-out bulb from the socket” could be expanded to:

a. grasp the burnt-out bulb b. turn the bulb counter-clockwise until it comes free from the socket c. throw the old light bulb away

Most of the time when we give directions, we give general directions, because we assume that the person knows the things we don’t tell them. For example, when we give driving directions, we might say “Drive north on highway 81 and turn west at exit 52”. But we could begin with “Walk to your car. Open the car door. Place the key in the ignition. Turn the key to start the car...” Computer programming tends to be like this. It is very detailed and very exact.

1. Write four lines of directions you would give someone to take out the trash.

____________________________________________________________________________

____________________________________________________________________________

____________________________________________________________________________

____________________________________________________________________________

LESSON 1 QUIZ

C O M P U T E R P R O G R A M M I N G

Computer Programming (MAT414 Rev. 12A) Seton Home Study School Course Lesson Plans | Revised 5/2012 High School11

LESSON 2

To understand computer statements.

OBJECTIVE

Work through chapter 2 in the Small Basic manual.

Programming languages are very picky. They want every-thing to be just right, or else they will not work. When you talk to people, they can understand what you mean, even when you don’t say exactly what you mean. People inter-pret what you say. For example, if your Mom says to you, “Your room is getting a little messy” what she really means is “Clean your room!” Computers do not try to understand your meaning. They only know what you tell them, and they want you to be very clear and exact.

If you want the computer to write “Hello World” then you must use the line:

TextWindow.WriteLine(“Hello World”)

You can’t use:

TextWind.WriteLine(“Hello World”)Window.Write(“Hello World”)TextWindow.WriteLine(Hello World)

Fortunately, the computer programs such as Small Basic give you a lot of help. They will try to make sure that the lines you write are correct. That makes creating a program a lot easier.

1. How would you tell the computer to write “I like programming” in red text?

___________________________________________________________________________

___________________________________________________________________________

2. In the line TextWindow.WriteLine(“Hello World”), what is the object involved?

___________________________________________________________________________

Activity

Write a program that prints “This line is in yellow” in yellow on the textwindow, and then prints another line that says “This line is in blue” in blue.

LESSON 2 QUIZ