computer مراجعة حاسب آلى 3 ع ت1

218
El-Zahraa Language School Computer Booklet For M3 تدائي الContents Subject Page Chapter one: an introduction to programming 2 Work Sheet 1 4 Chapter two: flowcharting 7 Work Sheet 2 13 Chapter three: pseudo code 24 Work Sheet 3 32 1

Upload: -

Post on 03-Jul-2015

1.184 views

Category:

Education


2 download

DESCRIPTION

مراجعة

TRANSCRIPT

Page 1: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Contents Subject Page

Chapter one: an introduction to programming 2

Work Sheet 1 4

Chapter two: flowcharting 7

Work Sheet 2 13

Chapter three: pseudo code 24

Work Sheet 3 32

1

Page 2: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter four: Object Oriented Programming 37

Work Sheet 4 40

Chapter five: Introduction To Integrated Development Environment (IDE) 42

Work Sheet 5 50

Chapter Six: Introduction to controls 55

Work Sheet 6 69

Governorate Exams 75

2

Page 3: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3

Page 4: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter 1

An Introduction To Programming

Information system : Is a combination between technology (computers) and people that enable organization to collect data, store it, and transform it into information.The difference between Data and Information:-

Data Information

4

Page 5: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1) Raw of facts that are collected and stored by the information system.2) Can be in the form of numbers, letters, images, sound clips, video clips, names, dates, prices, temperatures, and grades in an examination.

1) Data after processing.2) There are many familiar kinds of information such as written reports, lists, tables, and graphs.

* Software: is composed of one or more lists of instructions called programs.

* Programming: is the process of creating these lists of instructions of the programs.

* Algorithm: The step by step logic of solving problems.

* Variable: It is a memory location that holding a piece of data which assigned a name.

5

Page 6: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

* The six operations that computer can carry out to process data into information:-

1. Input data (reading data).

2. Store data in internal memory.

3. Perform arithmetic operation on data.

4. Compare two values and select one of two alternative actions.

5. Repeat a group of actions any number of times.

6. Output the results of processing.

6

Page 7: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The advantages of VISUAL BASIC .NET:-

1- Enables you to write windows applications.

2- Replaces many of the numbers used by machine language with words and

symbols that we can more easily understand and remember.

3- Enables a programmer to visually assemble a program's window from parts in a

toolbox.

interpretationcompilation7

Page 8: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1 ) interpreted program will run slower

than an Compiled program

2) Errors are more easier to find during

interpretation

1 ) Compiled program will run faster

than an interpreted program

2) Errors are more difficult to find

during compilation

Notes:-

* Th e r e a r e ma n y k i n d s o f programming languages, including FORTRAN,

COBOL, C++, C#, JAVA, and Basic. There are many versions of the BASIC

languages the older versions of it like GW-BASIC, and QuickBasic can do programs

for DOS operating system only. The DOS versions are now obsolete.

8

Page 9: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

* Visual Basic has an advantage over other languages in that Visual Basic projects

can be interpreted during the design and testing process, but can then be

compiled into an executable program when all the errors have been removed.

9

Page 10: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 1

Complete :

1- ……………is the combination of technology ( computers ) and people that enables organization to collect data, store them to transform it into information.

2- ……… are raw of facts which are collected and stored by the information system.

3- Data can be in the form ………., …………, ………… ………… or ……………….

4- Software is composed of one or more lists of instructions called ………….. and the process of creating these lists of instructions is ………………...

5- Once data have been input, they are stored in memory locations are called…………… .6- The arithmetic operations like ………… , ………… , ………….. , ……………

and …………...7- Output information can take many forms display on a ………… , …………. and

10

Page 11: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

………………..8- …………… is a form of problem solving which aim is to develop a step by step

process to solve the problem .9- Computers understand …………… language which is entirely composed of ….

and …. 10-The programming languages are such as Visual basic.net which has ………….

and ……………… to change English into machine language. 11- There are many kinds of programming languages including ………… , ………….. , ….., ….. ,…….. and……….. 12- The older versions of basic are ……………. and ……………. can do programs

for Dos operating system only. 13- Visual basic.net replaces many of the numbers used by machine language

with ………… and …………… 14- English languages are referred …………… language because they are close to

the ……………..

11

Page 12: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

15- There are two translation process to machine language ……………….. and ………………

16- The ………….. is faster than …………. to convert the English to machine language.

17- The errors are more difficult to find during ………………. translation.

12

Page 13: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Put ( ) or ( X ) :

1- Data may come from a barcode reader. ( )2- Input data can not come from a flash memory. ( ) 3- Computers understand high level language into the machine language. ( )4- Basic cannot change English language into the machine language. ( ) 5- We cannot write windows application through visual basic.net. ( ) 6- Quick basic can write windows application. ( ) 7- VB.net can be more easily understand and remember than the older versions. ( )8- The interpretation process stops and an error message is displayed when the program

encounter a statement's error. ( )9- Interpreted program is faster than a compiled program. ( )

10- The errors are easier to find during compilation. ( ) 11- VB.net projects have a compiler only. ( )

13

Page 14: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

12-Machine language is called "High level language" ( ). 13-The compiler is characterized by the easiness of the errors discovery and the

speed of running the program ( ). 14-The machine language which the computer can understand is written in English

but it has a set of rules and conditions when writing it ( ). 15-The compiler changes the instructions of the programming language completely

into the machine language before performing any instruction ( ).

Mention the six operations to perform ( convert ) data into information:-

1. ………………………………2. ……………………………….

14

Page 15: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3. ………………………………...4. …………………………………5. …………………………………

6. …………………………………

Define the following :

1. Information System:…………………………………………………………………………………………………………………………………………………………………………

2. Software :…………………………………………………………...

3. Program :

15

Page 16: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

…………………………………………………………………….4. Programming : ……………………………………………………………...5. Variable :

……………………………………………………………………..6. Algorithm:

……………………………………………………………………...

Compare between each of the following

a. Data and Information:

16

Page 17: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

b. High level language and Machine language:

High level language Machine language

17

Data Information

Page 18: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

c. Compilation and Interpretation:

Compilation Interpretation

18

Page 19: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

19

Page 20: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter 2

Flow Charting

The main needed steps for problem solving as follows:

1. Define the problem

2. Assemble known quantities and assign variable names

3. Discard unimportant data.

4. Establish relationships and express them as equations.

5. Determine the proper algorithm by arranging the equations in correct sequence.

20

Page 21: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example;-

A school has 1000 students of whom 48 percent are boys. The school gave a

party which 70 percent of the students attended. If 60 percent of those

attending were boys, how many girls attended the party?

Solution:

1. The question is: “How many girls attended the party?”

2. Let x = the total number of students attending the party

Let y = the number of boys attending the party

21

Page 22: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Let z = the number of girls attending the party

3. The given fact that 48 percent of the students are boys has no effect on the problem and may be discarded.

4. The relationships stated are:

a. 70 percent of the students attended ( x )

b. 60 percent of those attending were boys ( y )

c. This implies that the difference between x and y represents the number of girls attending (z).

22

Page 23: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

So, we express these relationships as the following equations:

a. x = 1000 * 0.70

b. y = x * 0.60

c. z = x – y

5. Since the variable x must be known to find the variable y and both x and y must be known in order to find z, the equations must be solved in the given order.

Flowchart: -

23

Page 24: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Is a diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem.

The 5 basic flowcharting symbols are:

1-Terminal block 2-Input / Output

3- Process block 4- Decision block 5- Flow lines

The following are some guidelines in flowcharting:

a. The flowchart should be clear, neat and easy to follow.

b. The usual direction of the flow of a procedure or a system is from left to right or top to bottom.

24

Page 25: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

c. Only one flow line should come out or from a process symbol.

d. Only one flow line should enter a decision symbol, but two or three flow lines.

e. Only one flow line is used in conjunction with terminal symbol.

f. you can use the annotation symbol to describe data or computational steps more clearly.

This is top secret data

25

End

Stop

Page 26: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

g. If the flowchart becomes complex, it is better to use connector symbols to reduce

the number of flow lines.

h. Ensure that the flowchart has a logical start and finish.

i. It is useful to test the validity of the flowchart by passing through it with a simple

test data.

Advantages of using flowcharts:-

a. Communications. b. Effective analysis.

c. Proper documentation. d. Efficient coding.26

Page 27: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

e. Proper debugging. f. Efficient program maintenance.

Limitations of using flowcharts:

a. Complex logic.

b. Alterations and modifications.

c. In the technical details of how it is done.

27

Page 28: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Examples:-

28

Page 29: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

29

Page 30: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

30

Page 31: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

31

Page 32: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

32

Page 33: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

33

Page 34: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

34

Page 35: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

35

Page 36: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 2

Complete :

1- The …………….is simply a tool which serves to assist in problem solving.

2- The …………… is a visually presenting the flow of data through an information

processing system.

3- The …………….. is a diagrammatic representation that follows the sequence of

operations to be performed to get the problem solution.

36

Page 37: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

4- The five basic flow charting symbols are………….., ……….. and ………… ,

………. , ………… and …………….

5- The usual direction of the flow of a procedure is from ……… to …………… or

from .……….. to ………..

6- The advantages of using flowchart are …………………. , ……………….. ,

…………………, ………………...

7- The disadvantages of using flowchart are ……………. , …………………...

Put ( ) or ( X ) :

37

Page 38: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1- Once the flowchart is drawn it becomes difficult to write the program in any

machine language. ( )

2- The direction of the flow of procedure is from right to left. ( )

3- We can draw only one flow line enters a decision symbols. ( )

4- We can draw two or three flow lines may leave the decision symbol. ( )

5- We can draw many flow lines from or to a terminal symbols. ( )

6- We can easy modify any alternation are required the flow chart. ( )

7-To express the input and output of data information in the flowchart s we use ( )

symbol ( ).

8 -Many programmers prefer the flowcharts over pseudo code when solving a program ( ).

38

Page 39: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Define:-

- Flowchart:………………………………………………………………………………………………………………………………………………………………………...

What are the main steps of "Problem Solving"?

a. ………………………………………….b. ………………………………………….c. ………………………………………….d. ………………………………………….e. ………………………………………….

39

Page 40: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

What are the basic flow chart Symbols ?

………… ……………. ……………. …………. ………….

Mention the rules of drawing a "Flow-chart":

1. …………………………………………………………………2. …………………………………………………………………3. ……………………………………………………………........4. …………………………………………….. ……………….….5. ………………………………………………………………….6. ………………………………………………………………….7. …………………………………………………………………..8. …………………………………………………………………..9. …………………………………………………………………..

40

Process block Terminal block

Desicion block Input / output blockFlow Lines

Page 41: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

What are the advantages of using flow-charts?

a. …………………. b. ……………………..c. ………………….. d. ……………………...e. …………………. F. ……………………..

41

Page 42: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

What are the limitations of using flow-chart?

a. …………………… b. ……………………………………. c. ………………………………………………………………..

Correct the drawed flowchart representing the addition of two numbers and printing the result

42

start

Result = Number1 + Number2

Read number1

Read number2

Output the result

End

( )

( …)

( …) )

(… )

( ... )

(… )

Page 43: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

43

Page 44: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

44

Page 45: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a flowchart to read the age of Hany and Hesham, then it prints the name of the elder?

45

Page 46: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a flowchart to read a temperature in Fahrenheit degrees and convert it into Celsius degrees, using the formula C = 5 ( F°- 32 )

9

46

Page 47: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

47

Page 48: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

48

Page 49: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

49

Page 50: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

50

Page 51: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a flowchart to represent the process of reading two numbers, dividing them,

and then displaying the result.

51

Page 52: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

52

Page 53: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a flowchart that reads the radius of a sphere " r " , then it calculates its volume

" V " and surface area " A " using formulas V = 3

4 ∏ r3 A = 4 ∏ r2

∏ = 7

22

If the read radius is Negative, flowchart should print a warning message then terminates.

53

Page 54: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

54

Page 55: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

55

Page 56: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

56

Page 57: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter 3

Pseudocode

Pseudocode :-

Means "false code". That means that it is not the programming language "code" or statements that are used to direct the action of the computer.

The only components used to write a pseudocode are:-

1. Words 2. Clauses 3. Sentences

57

Page 58: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Rules and Constraints:-

1. The data names of variables should be meaningful.

2. All statements should be written in a way that is easy to understand.

Program Logic Structures:-

1- Sequence

In pseudo coding, statements are done in sequential fashion unless one of the

statements contains an instruction that interrupts the normal sequential flow.

2- Selection

58

Page 59: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

An IF statement is presented. There can only be two outcomes as a result of the IF

statement being processed. One as a result of the tested condition being TRUE and the

other as being FALSE. Therefore the IF-THEN-ELSE control structure can be

represented as follows:

59

Page 60: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

IF condition being tested is TRUE

Then

Do all statements listed under “Then”.

(executed when the tested condition is “TRUE”).

Else

Do all statements listed under “Else”.

(executed when the tested condition is “FALSE”).

60

Page 61: Computer مراجعة حاسب آلى 3 ع ت1

M= 25

N = 12

IF ( M >= N ) Then

Statement 1

Else

Statement2

END IF

Statement 3

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Notes:-

The tested condition can be greater than(>), less than,(<) equal to(=), greater or equal to(>=), less than or equal to(<=), or not equal to(<>) . The result of testing the condition must be TRUE or FALSE.

Examples:-

61

Page 62: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Note that in this case Statement 1, followed by Statement 3 will be executed.

Note that if the tested condition was just an expression the result of which was a number, then only the value of zero will represent FALSE, where all other values will represent TRUE.

For example:62

Page 63: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

X= 10

Y = 5

IF (X – Y) Then

Statement 1

Else

Statement2

END IF

Statement3

So Note that in this case Statement 1, followed by Statement 3 will be executed.63

Page 64: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3- Iterations

This statement implies that a certain activity or action will be performed repetitively a certain number of times or until a certain condition is met.

Advantages and disadvantages of Pseudocode

� It is simple because it uses English-like statements.

� No special symbols are used.

� No specific syntax is used.

� It is very easy to translate its statements to that for high level languages on a one-for-one basis.

64

Page 65: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The main disadvantages of pseudocode is that :

� It can be quite lengthy for complex problems.

SOME EXAMPLES ON PSEUDOCODING

Example 1

65

Page 66: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Write a pseudo code to represent the process of reading two numbers, dividing them, and then displaying the result.

Note that: the corresponding flowchart is given in example 2.3.

Solution:

1. Input (Read) the first number “number1”.

2. Input (Read) the second number “number2”.

3. IF the value of number1 = 0 Then

Print “Division is impossible because number2 is zero”

Go to step 4

66

Page 67: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

ELSE

result = number1 / number2

Print number1, number2, and result

END IF

4. Stop processing

67

Page 68: Computer مراجعة حاسب آلى 3 ع ت1

3

4

7

22

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example 2

Draw a pseudo code that reads the radius of a sphere " r " , then it calculates its volume

" V " and surface area " A " using formulas V= ∏ r3 , A = 4 ∏ r2 , ∏ =

- If the read radius is Negative, flowchart should print a warning message then

terminates.

Solution:

1-Read r, ∏ = 7

22

68

Page 69: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2-If r = Negative then

Print a message "the calculations are impossible ".

Go to step 3

Else

V = 3

4 ∏ r3

A = 4 ∏ r2

Print V , A

3- Stop processing

69

Page 70: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example 3

Draw a pseudo code to find the largest of three numbers of A, B, and C.

Solution:

70

Page 71: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

71

Page 72: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

72

Page 73: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example 4

Draw a pseudo code to find the sum of first 100 natural numbers. This means that we want to find

sum where sum is given by: sum = 1+2+3+4+5+…………………………..+99+100.

Solution:

73

Page 74: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

74

Page 75: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 3

Complete :

1-The components of the "Pseudo code" are ………………, ………… and ………...

Define:-

- Pseudo code:

75

Page 76: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

……………………………………………………………………………………

….......................................................................................................................

What are the rules and constraints of the "Pseudo code"?

*………………………………………………………..

* ………………………………………………………..

Complete the following:

The advantages of "pseudo code" are

a. …………………………………………………

76

Page 77: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

b. …………………………………………………

c. …………………………………………………

d. …………………………………………………

The disadvantage of "pseudo code" is

………………………………………………………..

77

Page 78: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Write a pseudo code to represent the process of reading two numbers, dividing them,

and then displaying the result.

78

Page 79: Computer مراجعة حاسب آلى 3 ع ت1

3

4

7

22

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a pseudo code that reads the radius of a sphere " r " , then it calculates its volume " V " and surface area " A " using formulas V = ∏ r3 , A = 4 ∏ r2 ∏ =

- If the read radius is Negative, flowchart should print a warning message then terminates.

79

Page 80: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a pseudo code to find the largest of three numbers of A, B, and C

80

Page 81: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Draw a pseudo code to find the sum of first 100 natural numbers. This means that we

want to find sum where sum is given by: sum = 1+2+3+4+5+

…………………………..+99+100.

81

Page 82: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter 4

( OOP )

Object Oriented Programming

The Object Model

In Visual Basic you will work with objects, which have properties, Methods and events. Each object is based on a class.

Classes

82

Page 83: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

- A class is a template used to create a new object. Classes contain the definition of all available properties, methods, and events for objects created for this class.

- A prototype or blueprint for an object that includes the specifications for its properties and methods.

**Each time you create a new object, it must be based on a class.

Objects

Object is something that exists. We deal with objects in our daily life. In real world objects can be parts of other objects.

*Examples of objects in Object Oriented Programming (OOP) are forms and controls.

*My Pen object has properties like its color that is blue and the amount of ink in it which is low.

83

Page 84: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Properties

A characteristic or attribute of an object.

*When you refer to a property, you first name the object, add a period and then name the property. For example, MyPen.Color = Blue.

Methods

a predefined actions provided with an object.

84

Page 85: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

*Some examples of methods are: if the object is Auto The methods, or actions, of auto

might be Start, Speed Up, Slow Down, if the object is Form1 The methods of Form1

like Close, and Clear.

Events

An action that may be caused by the user, such as a click, drag, or key press.

*Events happen for objects in Visual Basic. For example the event of the mouse

movement on a window which is called "Mouse Move", or pressing a key on the

keyboard on a window which is called "Key Press", and so on. The Form will respond

to these events according to the instructions that were written before.

85

Page 86: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example:-

A comparison between a Form and a cassette:-

86

Page 87: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

87

Page 88: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The Object Oriented Terminology:-

Encapsulation

- It is sometimes referred to as a data hiding.

- An OOP feature that specifies that all methods and properties of a class be

coded within the class, the class can hide or show the properties and methods.

Inheritance88

Page 89: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

- Is the ability to create a new class from an existing class.

- By creating a new class that inherits from an existing class, you can add, or

modify class variables and methods.

- The inherited class is called a subclass, derived class, or child class, where the

original class is known as the base class, super class, or parent class.

- The real purpose of inheritance is reusability, which is a big advantage of OOP

over traditional programming. When you create a new class, you can then use

that class in multiple projects.

89

Page 90: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 4

Complete :

1- We deal with ……….. in our daily life.

2- A medicine in the form of a capsule is considered ………………

3- Car …………..white ………….. running in the street ……………..

4- In visual basic we work with objects, which have ………….., ………… and ………... Each object is based on a class.

90

Page 91: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Put ( ) or ( X ) :

1- The class is constructed out of object. ( )2- The computer is considered an object that is consisting of many objects. ( )3- The color of a pen is a "method ". ( )4- Making cassette on is considered "event ". ( )5- The shape of an object is determined by its properties. ( )6- Object has properties, Method, and events. ( )7- Object is constructed out of a class. ( )8- Encapsulation is used to hide information of the class. ( )9- Derived Class inherits from the base class properties only. ( )

Fill in the space using the following words:

91

Page 92: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Object - Class – Event – Property – Method – Encapsulation – Inheritance1- Clicking the mouse inside the window is considered……………2- The width of the window is considered …………..3- Pressing a key from the keyboard inside the window is considered ……………4- Properties that the son takes from his father is considered ……………..5- Going to school is considered ……………..6- Amount of water in a lake is considered …………….7- Circuit diagram of your cassette is considered ………….8- …………….. is considered hiding for information in a class.

Define:-

92

Page 93: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1. Object:

……………………………………………………………………………………

2. Properties:

…………………………………………………………………………………….

3. Method:

…………………………………………………………………………………….

4. Events:

…………………………………………………………………………………….

5. Classes:

…………………………………………………………………………………….

93

Page 94: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

6. Encapsulation:

…………………………………………………………………………………….

7. Inheritance:

………………………………………………………………………………….....

Compare between each of the following:-

- Form and Cassette:

Objects Form Cassette

94

Page 95: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Properties

Methods

events

95

Page 96: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter 5

Visual Basic 2005 IDE

The Visual Basic 2005 IDE

- The Visual Studio Environment is where you create and test your projects. - The development environment is called the Integrated Development

Environment (IDE).- The IDE consists of various tools, including a form designer, which helps you

to visually create a form; an editor, for entering and modifying program code; a compiler, for translating the Visual Basic statements into the intermediate machine code; a debugger, to locate and correct program errors; an object browser, to view the classes methods, and events; and a Help facility.

96

Page 97: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1-The IDE initial screen

97

Page 98: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

98

Page 99: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

- The contents of the Start Page vary, depending on whether you are connected to the Internet links.

2- The New Project Dialog

99

Page 100: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

You will create your first Visual Basic projects by selecting File/New Project or

clicking New Project on the Start page.

100

Page 101: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3- The IDE main window

Each window can be moved, resized, opened, or closed.

101

Page 102: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

4- The Toolbars

The Visual Studio toolbars contain buttons that are shortcuts for menu commands. The standard toolbar is shown Figure.

102

Page 103: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

5- The Form Designer

The Form Designer is where you design a form

103

Page 104: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

that interface. Change the size of the form by

selecting the border or by using the handles.

When you begin a new the default name “Form".

104

Page 105: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

6- The Solution Explorer Window

The Solution Explorer window holds the file included in your project and a list of the classes it references.

7- The Properties Window105

Page 106: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

We use the Properties Window to set the properties of objects in your project.

8- The Toolbox

The Toolbox contains the tools 106

Page 107: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

you use to place controls on a form.

107

Page 108: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Creating your first Visual Basic (VB) Project

To get started building your "Hello Egypt" application, follow the following steps:

1- After choosing File menu then select ”New Project” from the Visual Studio main menu, the New Project Dialog Box appears

- You can also double click “Create Project” in the “Recent Projects” pane.

2- In the "Project types" pane choose Windows and in "Templates pane" double click Windows Application.

108

Page 109: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3- Type the name you want to give to your project that will replace the default name in the Name text box. In this example, I typed "Hello".

4- Click OK.

5- Click the Toolbox on the left side of the screen.

The Toolbox appears, with Windows Forms Controls, I f you don't see the tool box ( view menu then select toolbox ).

109

Page 110: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

110

Page 111: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

3- Type the name you want to give to your project that will replace the default name in the Name text box. In this example, I typed "Hello".

4- Click OK.

5- Click the Toolbox on the left side of the screen.

The Toolbox appears, with Windows Forms Controls, I f you don't see the tool box ( view menu then select toolbox ).

111

Page 112: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

112

Page 113: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

113

Page 114: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

114

Page 115: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

6- On Form1, click the position as seen As you can see, means that the value of its default Text property “Button1.text" is button 1.

115

Page 116: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

116

Page 117: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

117

Page 118: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

118

Page 119: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Saving Your Application

1. Choose File -> "Save All" from the Visual Studio main menu. The Save Project Dialog Box appears.

119

Page 120: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Running your Windows Application Studio Environment:

Press F5 key on your keyboard project as a Windows program. Click the button on your form.

You will see that the button text will change into “Hello Egypt".

Running your Studio outside the visual basic Environment:

a. Choose Build Hello from the main menu.

120

Page 121: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Visual Studio will compile your application into a Windows program with file extension .exe. We will get executable fileHello.exe.

b. Go to the folder that contains your Windows application.

c. Double click Hello.exe to run it.

121

Page 122: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

122

Page 123: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

123

Page 124: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 5

Complete :

1-To create a new project select ……………. From………… menu then select

………….. from project type, select ………………. in the templates box to type the

project …………in name text box.

2- The visual studio toolbars contains buttons that are ……………. for ……………command.

3- …………… is where you design a form that makes your user interface.

4- You can change the size of form window by selecting the ……………...

5- ……………….holds the files’ names for the files included in your project.

124

Page 125: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

6-………………….. used to set the properties of objects in your project.

7- ……………. contains the tools you use to place controls on a form.

8- To load the button onto form1 ……………… the button control to load it.

9- To enter code view window ………………. the button control.

10- To change the text property of “button1 “ to “hello Egypt” write your code

………………. on the line preceding the end sub.

11- To save your application choose …………. from ………… menu to determine the

…………. of project

12- To run your window application within the visual press ………. key.

125

Page 126: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

13- To run your “hello” window application outside the visual choose ………………

from …………menu to compile it with file extension ……….. to open it by

………………. by the mouse.

14- IDE stands for ………………………………………..

15- To display or hide the visual studio start page select ……………. from…………menu.

16-You can open a new project by selecting ………………….. from ……… menu.

17-You can open an existing project from ……… menu or by using …………… from

………….page.

126

Page 127: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Put ( ) or ( X ) :

1-You can’t move or resize the visual’s windows. ( )

2- The properties window holds the files’ names included in your project. ( )

3- The properties window set the properties of objects in your project. ( )

4- Toolbar contains the tools you use to place controls on a form. ( )

5- The default value for “button1.text “ is “button1 “. ( )

6- To view the toolbox go to file menu. ( )

7- Visual compile the application with extension ( .bmp). ( )

8- To run your window application within the visual press F6 key. ( )127

Page 128: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

9- The contents of visual studio start page are the same to connecting to the

internet. ( )

10- To display or hide the start page from view menu. ( )

11- You can begin a new project from file menu. ( )

12- You can open an existing project from file menu only. ( )

13- To deselect the control click inside it. ( )

14- To delete a control, select the control then press shift on the keyboard. ( )

15- To move a control select it then point inside the control and drag it to a new

location. ( )

16- To resize a control, you should drag the handles. ( )

128

Page 129: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

17- To select a control, double click on the control. ( )

18- To make a properties window active, click on the title bar of it. ( )

19- You can align the controls automatically. ( )

20- To debug the project select from the keyboard. ( )

21-You can stop running the application select small X in the upper right of the

form window. ( )

129

Page 130: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Choose the right answer between brackets:-

1- To run you window application within the visual studio press (F10-F5-F6) key from the keyboard.

2- To enter code view window ( right click –left click – double click) the button control.

3- ( Properties window – Toolbox – Tool bar ) contains the tools you use to place controls on a form.

4- ( Properties window- Solution explorer- Form window ) holds the files’ included in your project.

5- ( Web part – Recent project) is useful if you are looking for learning opportunities.6- You can open an existing project by using ( View – Build – File )menu .

130

Page 131: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Task :

Create a user interface with button controls that is shown

131

Page 132: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

132

Page 133: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

133

Page 134: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

134

Page 135: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Answer the following questions:

Question 1:

- What is the IDE mnemonic stands for?- ……………………………………………………………………………………

135

Page 136: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Question 2:

- Mention the uses of the properties window and toolbox?- ……………………………………………………………………………………

………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

136

Page 137: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Chapter six

An introduction to controls

The Windows Form Control

When you create a Windows Application new project, the IDE will automatically

create a "Windows Form"

The Button Control

137

Page 138: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

It was mentioned in the previous chapter that, primary function is to react to a click of

the user and perform a task associated with that button. In other words, it executes a

preprogrammed function when the event of clicking the button happens.

Button's appearance and properties

The Button control appears as a rectangular shape. Its face can contain text, image, or

both.

138

Page 139: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

139

Page 140: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

140

Page 141: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example 1

141

Page 142: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

142

Page 143: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

143

Page 144: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

144

Page 145: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

145

Page 146: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

146

Page 147: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

147

Page 148: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Solution:

148

Page 149: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

149

Page 150: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Form1.Text property to be Buttons

150

Page 151: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

151

Page 152: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

152

Page 153: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

153

Page 154: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Write a Click Event Handler for btnShow_Hide

154

Page 155: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

155

Page 156: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

g- Write a Click Event Handler for btnEnable_Disable

156

Page 157: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

157

Page 158: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

158

Page 159: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

We can save the project using File then select save all .

** Select Start Debugging from the Debug menu or click on the Start icon on the Toolbar.

159

Page 160: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The Text Box and Label Control

The following Table provides a list of commonly used Properties for Text Box control:-

160

Page 161: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

161

Page 162: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Label Control's appearance and properties

162

Page 163: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

163

Page 164: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Example

Create a project that contains two Text Boxes. When you add any character in the upper Textbox it appears in the lower Tex Box in Uppercase format. The Output has to look as given in Figure.

Note that text strings have a method that is called To Upper() that can convert all lowercase characters into uppercase characters. If an object X has Text property, then to change its text to uppercase using To Upper() method, you have to write the following statement : X.Text.ToUpper()

Solution

164

Page 165: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

165

Page 166: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The table shows the controls on the form and the values of properties that have been changed at design time.

166

Page 167: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

167

Page 168: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Write TextChanged Event Handler for TextBox txtSource

Double-click on "txtSource" TextBox. This will open up the Code window and also create the first and last statements of the "TextChanged Event Handler".

Methods

168

Page 169: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The following table contains a number of TextBox methods available to help the developer.

169

Page 170: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

170

Page 171: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

The MsgBox Statement

MsgBox statement stands for “Message Box statement”. It is an alternative way to the label control for displaying information to the user.

The MsgBox statement is better than the label control when it is important that the user read the information. For example, if an error has occurred, then the developer might want the user to know this and not let him/her continue until he/her is

171

Page 172: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

acknowledged about this problem while in case of label control the user is free to read or ignore information displayed by it. The program execution pauses while the message box is displayed and only resumes after the user has clicked on a button on the message box.

The syntax for MsgBox Statement:

MsgBox( Arg1 , [Arg2], [Arg3] )

172

Page 173: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

173

Page 174: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

174

Page 175: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Note that:-

• Me :- refer to the current form.

• Syntax Error:- It indicates if you spell something wrong in the code window you

will see a squiggly line under the problem and an error list will pop up telling

what the problem is.

• Intellisense Technology:- It helps the programmer by checking spelling and

providing suggestions on what to include in a statement.

• Empty String:- It is “” .

175

Page 176: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Work Sheet 6

Complete :

1- The button control appears as a ……………. shape, its face can contain ………… ,……….. or the both..

2- The button control is an …………which has a number of ……………. such ………., …………. and ………….

3- …………… property gets the background color for the control. 4- ………………… property gets the image back to the control as a wallpaper. 5- …………. sets a value indicating whether the control can respond to user interaction. 6- ……………. gets the font of the text displayed by the control. 7- …………….. gets the ground color of the control. 8- ……….. used to identify control in code. 9-…………. sets the text is what appears on the face of the button.

176

Page 177: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

10- …………. sets the alignment of the text on the button control. 11- …………. sets a value indicating whether the control is displayed. 12- The prefixing of each control with ……….. letters that identifies the ……….. of

control. 13- The "……… " property determines the type and size of the font but the

…………….determines its color. 14- The ……………and ………………… properties deal with what you see in the

background. 15- ……………… and …………… properties determine the vertical and horizontal

alignments for the text and images. 16- " Text align " property to be ……………….that means that the text is vertically at the

bottom but horizontally is centered. 17- To enter the code window and type a code that is executed is called ……………. , it

happens when ………………. the control.

177

Page 178: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

18- The blue lines which are around the controls called ………….. which can help you align your control.

19- You can align the controls by using …………… menu then ………….. 20- Each event handler begins with …………….. and ends with ………………. 21- To debug the project select ……………….. from …………… menu. 22- You can stop running the application select …………… from ………….. menu. 23- ………………is when you spell something wrong in the code window, you will

see a squiggly line under the problem. 24- We can label the controls by……………object. 25- The label control is a …………….. area that can be filled with ………... 26- ……………… gets the shape of the border for the control. 27- ………. keyword is used to save time and typographical errors when you enter

the code. 28- The …………….. control is a data entry control.

178

Page 179: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

29- …………………….. sets whether the textbox control modifies the case of characters as they are typed.

30-……………… sets a value that indicates that the textbox control has been modified by the user.

31- ……………………. gets the character used to mask characters of a password in a single line textbox control.

32- ………………. gets the length of the text in the textbox control. 33- …………….. gets the starting point of the text selected in the textbox. 34- ………………. gets the number of characters selected in the textbox. 35- ………………. property controls the maximum number of characters the user can type. 36-………….. property prevents the user from typing into the textbox when it is set

to true. 37- To type Source, press ………… key from the keyboard to under line S. 38- The result of typing txtvisual.text= " Visual Basic is " and txtvisual.AppendText("

a very nice subject ") is ……………………………………..

179

Page 180: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

39- ………………. statement is better than the label when it is important that the user read the information.

40- The types of message are …………… , ……………..,…………… and …………… .

Put ( ) or ( X ) :

1- The intellisense technology allows you to see all possible members for a specific object. ( )

2- To select any member from the intellisense menu double click it. ( ) 3- There is an icon next to the member show if it is property or method. ( ) 4- We can use label control to show the answer to the question. ( ) 5- We always write event handler for the label control. ( ) 6- "" is called the "empty string ". ( ) 7- " VB" refers to the current object (form). ( )

180

Page 181: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

8- Intelisense list of the controls appears by using " Me " keyword followed by a period. ( )

9- You can not omit "me" and the program won't run. ( ) 10- You can limit what the user types in the textbox. ( ) 11- You can write in the textbox in multiple lines. ( ) 12- The text box's multiple line must with the scroll bar. ( ) 13- You can surround the text box with a border. ( ) 14- Max length gets a value indicating whether this is a multiline textbox. ( ) 15- You can make the text in the text box is read only. ( ) 16- You can get a scroll bar appears in a multiple text box. ( )

17- You can wrap words to the beginning of the next line when necessary in the text

box. ( )

181

Page 182: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

18-In V.B language "Solution Explorer Window" contains a set of buttons which represents abbreviation of some instructions inside the menus. ( )

Choose the right answer between brackets:-

1- ( Visible – Enabled ) sets a value indicating whether the control can respond to user interaction.

2- ( Image – Forecolor – Background image ) sets the image displayed in the control as a wallpaper.

3- The prefixing for button control is ( lbl – btn ). 4- ( " btnsub " – " btnadd " – " btnmod " ) gives that it is a button that will do an

addition.5- To view the properties window select it from ( file – edit – view ) menu.6- To view the toolbox select it from ( edit – file – view ).

182

Page 183: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

7- To save the V.B net project select ( save – save all – recent ) from file menu.8- To debug the project press ( F5 – F6 – F7 ) from the keyboard.9- ( Label – Button – Textbox ) provides an area for the user to type while the program executes.10- ( Max length – Multiline – Modified ) sets the maximum number of characters the

user can type .11- ( Character casting – Max length ) property will automatically change whether the

user types to either uppercase or lower case.12- The button control appears as a ( circle – rhombus – rectangle ) shape.

Define:-

1. Syntax error :…………………………………………………………………………………………………………………………………………………………… .

183

Page 184: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2. Intellisense technology :………………………………………………………………………………………………………………………………………………………………………….. .3. Empty String :………………………………………………………………………………………

Task:-

184

Page 185: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

185

Page 186: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

186

Page 187: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Exercise:

a- Is writing “btnCalculate” as a Text property for a button a good idea? Explain?

………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

b- Is there is any sense to set the Text property of a Label control, an empty string? Explain.

187

Page 188: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

c- What is the advantage of the Msg Box control over the label control?

………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………

188

Page 189: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Behaira Governorate (2009)

Q.1: Your teacher asked you to rotate a shield with 50 teeth ten times. How many teeth that were rotated. Draw a flow chart that can achieve this.The answer:

189

Page 190: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Q.2 Write the result of each pseudo code.

190

Page 191: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

M=25N=12

If(M>N) thenX=M-N

ElseStatement2

End IfX=…………

B=10BMW=13

R=2If B<> BMW thenSUM=BMW+(B)R

End If

SUM=…………

191

Page 192: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Q.3 Write the pseudo code for reading the radius of a circle (r) and calculate its area and circumference.

The answer:1. ……………………………2. ……………………………………………………………………..………………………………………………………………………………………………………….……………..3. …………………………………….4. ………………………………….. ……………………….

192

Page 193: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

5. ……………………………………6. ……………………………………7. ……………………………………

Q.4 Re-arrange the following steps to solve a problem.

1 Find relations between the variables ….2 Name each variable ….3 Arrange the equation according to the priority of execution ….4 Neglect the unnecessary data ….5 Identity the required the problem ….

Q.5 Put (√ ) or (X):

1. Flow chart can replace pseudo code on solving a problem ( ).

193

Page 194: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2. Inputting and outputting have a parallelogram shape in flow chart ( ).

3. If Y=5 , M=Y2 -Y then M equal to 7 ( ).

4. Compiler converts the whole program to machine language before execution ( ).

194

Page 195: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Alexandria Governorate (2009)

Q.1 Put (√ ) or (X):1. The programming languages are written in English with different syntax from

one language to another ( ).2. In pseudo code the “If statement” is used in selection ( ).3. The programmer can create and test the visual basic projects through Integrated Development Environment (IDE) ( ).4. The Visual Basic .net language has got an interpreter and a compiler ( ).5. The pseudo code contains standard symbols that should be memorized ( ).6. The “class” is constructed out of the “object”( ).

Q.2 : choose the correct answer . 1. Hiding data inside object where other properties and methods can be accessed is

called ……………………..( encapsulation – inheritance – class).195

Page 196: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2. Integrated Development Environment (IDE) ,the “label “ can be added through ………..(toolbox – properties – solution explorer ). 3. To hide or show the “ Button” tool, use the property ………….( Name –

Enabled – Visible ). 4. Actions associated with objects are called …………( properties – methods –

events ). 5. The property which prevents the user from typing into the textbox is called

………….( read only - modified – text ). 6. To make the user read the information during the runtime, use …………..

( textbox – label – msgbox ).

Q.3 A.complete the following sentences:1. Clicking the mouse inside the form window and window responds to it according to certain commands is considered …….……..

196

Page 197: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2.Running the application within the visual studio environment press………………on the keyboard.3. The tool which is used to display text that can’t be altered by the user is called………………4. To save the application in IDE, select the command…………………from ‘file’ menu.

197

Page 198: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Re-draw and correct the flowchart

198

start

Result = Number1 + Number2

Read number1

Read number2

Output the result

End

( )

( …)

( …) )

(… )

( ... )

(… )

Page 199: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

199

Page 200: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

200

Page 201: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Menofia governorate (2009)

Q.1 complete the following:

1. When a program uses ……..…….., the high- level statements are converted into

equivalent machine –language statements one at a time as the program is executed.

2. …….…..means developing the programs by which it is possible to create

develop computer programs.

3. MsgBox is charactarized over label in

that…………………………………………………...

4. …………….…….is considered hiding for information in a class.

201

Page 202: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

5. When the “ToolBox’ doesn’t appear on the screen , we display it by opening

‘view menu’,then we choose… …………. ……….

Q.2 : Put (√ ) or (X): 1.When using “If statement” in pseudo code , the result shouldn’t be far from two

potentialities: False – True ( ).

2. Label is used as a board to put on it the other controls( ).

3. ForeColor property gets or sets the background color for the control( ).

4.When you begin a new project , a new form is added to the project with the default

name “ New Form” ( ).

5. Pseudo code is statements written in abbreviated form to show the steps required to

solve a specific problem ( ).202

Page 203: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Q.3 : (Man was walking in the street and his name Mohamed. Suddenly the sky

started raining heavily. He ran very quickly to avoid the rain. He wear heavy

clothing). Complete the following table:

Object Property Value of property Event MethodsMan ………. …………. ………. ……….

203

Page 204: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Q.4 :Draw a flow chart to read the age of haneen and salma, then it prints the name of the elder.

204

Page 205: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

205

Page 206: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

ElGharbia governorate (2009)

Put (√ ) or (X):

1. Derived class inherits from the base class properties only( ).

2. The property (forecolor) is used to set the background color for the control( ).

3. The textbox is a data entry control, it provides an area for the user to type while

the program executes( ).

4. When we use selection in pseudocode “ if statements” is presented, the statements

listed under “Else” executed when the tested conditions is “true”( ).206

Page 207: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Q.2 :Choose between brackets:

1.Object Name . ………= value( method – event – property ).

2.To set the text associated with the control, the text is what appears on the face of

the button, we select ……………( name - text - enabled ).

3.”Me” refers to the ……………..( current object form – button – label ).

4. To copy the contents of textbox 1 in the property text for label1 we write the order

………….

207

Page 208: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

a) textbox1.text=label1.text

b) label1= textbox1.text

c) label1.text = textbox1.text

Q.3 :A) Draw a flowchart to read the age of hany and hesham then it prints the name name of the older .

208

Page 209: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

209

Page 210: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

B) Write the scientific term for the following sentences:

1. It is a template used to create a new object. ( …………. )

2. It is a predefined actions provided with an object ( ………….. )

3. It translate the entire program into machine language before any attempt to

execute it. ( …………. )

4. It is a diagrammatic representation that illustrates the sequence of operations to be

performed to get the solution of abroblem.( ………….. )

210

Page 211: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

211

Page 212: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

212

Page 213: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Alexandria Governorate (2010)

First Question:-

Put a (√) next to the correct sentence and a (x) next to the wrong one:-

1. The flow chart helps in debugging process.( )

2. Using specific syntax is not one of the advantages of pseudo code.( )

3. The execution of the codes in the OOP model follows a sequential logic.( )

213

Page 214: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

4. The window which helps the programmer in designing the user interface is called window designer.

( )5. The debugger tool is used for getting a help facility of visual basic program.

( )6. To create a new project, select New project from file menu.

( )7. The ForeColor property is used for setting the font of text displayed by the

control. ( )8. The Textbox control provides the user a place for typing while the program is

executed. ( )9. The MsgBox statement is used for displaying information to the user.

( )10.The property Visible is used for displaying and hiding the control.

( )

214

Page 215: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

Second Question:-

Choose the correct answer:-

1. In the flow chart, the symbol which stands for a process operation is the symbol number………

( , , ).

215

Page 216: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

2. When the program performs a certain action a number of times, this process means……………

( Selection , Inputs , Iteration ).

3. In the IDE, any control can be placed on the form from ………………

( Solution explorer , ToolBox , Properties ).

4. To select the name of the control, the property …………….. is used.

( Image , Name , Text ).

5. The property which sets the character used to mask the characters of a password is ………….

216

Page 217: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

( PasswordChar , ReadOnly , MaxLength ).

6. To set the background color of the button control, the property…………is used.

( BackgroundImage , BackColor , ImageAlign ).

Third Question:-

Match (A) with (B), then write complete sentences :-

(A) (B)

217

Page 218: Computer مراجعة حاسب آلى 3 ع ت1

El-Zahraa Language School Computer Booklet For M3 التبتدائي

1. To determine the shape of an object , use

2. Actions caused by the user and the object responds to are

3. Actions associated with objects are called

4. Something that exists is called

a) Object

b) Properties

c) Events

d) Methods

e) class

218