book 3d_prep_eng_firstterm.pdf
Document Details
Uploaded by Deleted User
2012
Tags
Full Transcript
Arab Republic of Egypt Ministry of Education General Administration For Developing Computer and Information Technology Third grade preparatory First semester Third grade...
Arab Republic of Egypt Ministry of Education General Administration For Developing Computer and Information Technology Third grade preparatory First semester Third grade preparatory First semester Preparation Samir Hassan Mohamed Dr.Gamal Eldin Mohamed Amin General Manager Technical Office Manager Educational Computer Department Technology Development Center Ahmed Abdallah Mansour Tamer Abd ElMohsen Mansour Computer Expert Computer Expert Educational Computer Department Educational Computer Department Translation Aziza El Sayed Bassiouny Saleh Marzouk El Refaie Computer Expert English Language Counselor Educational Computer Department Ministry of Education (Formerly) Review Prof.Mohamed Fahmy Tolba Prof.Ahmed Mohamed Mahmoud Tobal Minister’s Advisor for Information Technology Minister’s Assistant for Information (Formerly) Technology(Formerly) 2012/2013 (2) Introduction Dear students, we offer this book in computer and information technology, as amended and revised by a group of university professors and experts who specialize in this area. We hope to keep you informed of the latest developments in era of technology to keep pace with scientific development in problem solving, flowcharts and the basics of programming through the dot-net style. This is done in a simplified manner as the first step in the path of programming. This branch is very up to date; the world of computers and information technology relies greatly on it as we are going to see through the first and second semester books. The work team (3) Index content page Chapter I :Problem Solving 5 Problem Solving. 6 Problem Solving Stages. 6 Flowchart. 8 Simple Flowchart. 8 The use of Branching (Decision) in Flowcharts. 12 The use of Loop in Flowcharts. 16 Questions. 22 Chapter II :Introduction to Visual Basic.Net 24 The language of Visual Basic.net. 25 Programing and computer memory 25 The language of Visual Basic.net and Framework.net 25 Visual Basic.net and IDE 26 Questions. 30 Chapter III :Controls 32 Form. 33 Button. 36 Label. 39 Textbox. 40 ListBox. 40 ComboBox. 41 GroupBox. 42 RadioButton. 42 CheckBox. 44 Questions. 45 Chapter IV:Code Window 48 Code Window. 49 Event Handler. 49 Setting the (Properties) programmatically. 52 Questions. 53 (4) Problem Solving [ By the end of this chapter, student will be able to: Define the problem. Identify the problem solving stages. Write steps to solve the problem “Algorithm”. Draw flowcharts that reflect the steps of the solution. (5) In your daily life, you may face a lot of problems through various activities that contain many problems. Problem is a situation that requires a solution or an objective you want to achieve through following consecutive steps sequentially. Problem Solving is the steps, activities, and processes to be done to reach an output or objective. Consider the following problem: The problem is: Baking a cake according to certain specifications, input available are the ingredients (such as eggs, flour, milk …etc.), then followed by activities or procedures that should be done sequentially to get the cake in suitable shape. Dear student In this book, we focus on Problem Solving techniques using the computer. First: Problem Definition: Problem definition implies the identification of required outputs, available inputs and, arithmetic and logical operations to be executed. Second: Algorithm Preparation: Algorithm is one of the methods used to solve a problem through logically arranged procedures. After identifying and analyzing the problem, outputs and inputs; a plan in the form of a series of successive steps is made which is called an (Algorithm), devised by the Mathematician and the founder of Algebra “Muḥammed ibn Mūsā al-Jwārizmī”. One of the methods to represent algorithm is flowchart. (6) Flowchart: It is a diagram that uses standard graphical symbols to illustrate the sequence of steps required for solving a problem or specific question. Some advantages of flowcharts: Facilitating the reading and understanding of the problem and illustrating to the programmer what must be done. Useful to explain the program to others helping in documenting the program in better manner, especially if the program is complicated Third: Program design Having drawn a “Flowchart” to solve the problem, using a computer; we have to translate this flowchart into one of the programming languages. Fourth: Program Testing During writing a program we unintentionally make some mistakes e.g. writing a minus sign (-) instead of (+). We cannot detect errors unless we begin entering data to the program with previously known results; and compare the results of the current program to those of the well-known results and so you can discover the errors and correct them. Fifth: Program Documentation This step includes writing all steps taken for solving the problem that include: given Input, output, plan for solving the problem, drawn flowchart, programming language used for coding , instructions, date of last modification of the program and, people who contribute to the program development process. This is done to have the program documented to go back for feedback and correction. This documentation is beneficial when more than one person participate in writing or modifying the program. Dear Student After we have learnt about the problem-solving stages and flowcharts, we will learn about some standard (agreed on symbols), Special symbols can also be used for exceptional cases. Here are some of the most commonly used symbols as shown in table (1-1) (7) Significance symbol )Terminal( ) Input/Output ( )Process( )Decision( )Flow Lines( Table (1-1) Common symbols for Flowcharts First: Define the problem Output: The sum of two numbers Input: The first number is “A “and the second number is “B” Processing (Solution): C =A+B where the result is C (8) Second :Algorithm Third :Flowchart 1 Start Start 2 Enter the number A and the number B Enter A and B 3 Performing the sum of the two numbers using this equation C=A+b C=A+B, the output is C 4 Print the output C Output C 5 End End Table (1-2) Algorithm and Flowchart for summation of tow numbers 1- The flowchart should start with the Start symbol and end with the End symbol. 2- A,B,C are variable names.The variable refers to a memory storage that holds a value. 3-The equation: C =A+B, indicates the sum of the value of A, to the value of B, and stores the result in C. 4-Entering values in A and B is done by using the term “Enter”, inside a parallelogram, you can also use another term to get the same meaning like “Read” or “Input”. 5-The sum equation is written inside the rectangle, as it represents an arithmetic operation. 6-The output is expressed with a parallelogram using the term “Output”, we can also use another term like “Print” or "output". 7-Note that flow line shows the order of an Algorithm. (9) First: Define the problem Output: The value of “Y”. Input: X. Processing (Solution): Compute the value of “Y” from the equation Y=3x+2. Dear Student / remember: 1. The left hand side (LHS) of any equation should contain only one variable; the value of this variable will be the (output) or the solution of the equation. 2. The right hand side (RHS) of the equation may contain abstracted values or arithmetic expressions that have one or more variables (inputs). Second :Algorithm Third :Flowchart 1 Start Start 2 Enter value of X Input X 3 Calculate Y =3*X+2 Y=3*X+2 4 print value of Y Print Y 5 End End Table (1-3) Algorithm and Flowchart to solve a first degree equation (10) Dear Student/ Notice The word “Area” refers to a Variable name, whose value is the calculated area of the rectangle; also “Perimeter” is a variable name whose value is the calculated perimeter of the rectangle. Variable names are chosen to WELL indicate the content of the variables. First: Define the problem Output: Input: Solution : Second :Algorithm Third :Flowchart (11) There are many problems that contain a question requires a Yes or No, or requires branching to other processes determined by flowchart. First: Define the problem Output: print the word “ “. Input: the score X. Solution: If the value of X is greater than or equal 50; the word “ ” will be printed. Second :Algorithm Third :Flowchart 1 Start Start 2 Enter the values of X 3 If X> =50 then Enter X 3-1 Print “ successful ” 4 End X>=50 Print successful End Table (1-4) Algorithm and Flowchart to print the message “”ناجح Dear Student / Notice The execution of step (3-1) will be done only when the value of x is greater than or equal to 50 (the result of the condition is True), then it moves to step (4); otherwise when the value of x is less than 50 (the result of the condition is False), the execution is transferred to step 4 directly. (12) First: Define the problem Output: print the result of dividing two numbers “R” or print the word “undefined" Input: Numerator is “num1”, denominator is “num2”. Solution: if num2=0 then print “undefined”, otherwise print the result of the division “R”. Second :Algorithm Third :Flowchart 1 Start Start 2 Enter the Numerator num1 Enter num1 3 Enter the denominator num2 4 If num2 =0 then Enter num2 4-1 Print “undefined” print Num2=0 4-2 Go to step 7 “undefined” 5 R=num1/num2 R=num1/num2 6 Print R Print R 7 End End Table (1-5) Algorithm and Flowchart to print the division of two numbers Dear Student / Notice 1. Step (4) is a decision (represented by the rhombus shape) It is a comparison that evaluates this question (is num2=0?) If the result is Yes then the word “undefined" will be printed according to mathematical rules; then the execution will be transferred to step (7) to end the program and prevent the execution of the division. 2. If the result of the condition in (step 4) is false, the execution will be transferred to step (5) directly because step (4-1) and (4-2) won’t be executed. (13) First: Define the problem Output: print the number type (even or odd). Input: the number “N”. Solution: the even number is determined if the entered number is divisible by 2 without remainder, otherwise it will be odd. Second :Algorithm Third :Flowchart 1 Start Start 2 Enter N 3 If N is divisible by 2 without Get N remainder then 3-1 Print “even number” N 4 Else divisible by 2 4-1 Print “odd number” 5 End EVEN ODD End Table (1-6) Algorithm and Flowchart to enter a number and print its type (odd or even) First: Define the problem Output: print out “greater than zero” – “less than zero “or “equal zero”. Input: temperature degree Celsius “D”. Solution: the temperature degree entered will be compared to zero. (14) Second :Algorithm Third :Flowchart 1 Start Start 2 Enter D (temperature degree) Get D 3 If D=o then 3-1 Print “Equal zero” Print D =0 Equal 0 4 Else Print 4-1 if D