Similar documents
Microsoft Visual Basic 2005: Reloaded

UNDERSTANDING PROBLEMS AND HOW TO SOLVE THEM BY USING COMPUTERS

SNS COLLEGE OF ENGINEERING

Chapter 1. Introduction to Programming and Visual Basic Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of

You will have mastered the material in this chapter when you can:

SNS COLLEGE OF ENGINEERING,

First Visual Basic Lab Paycheck-V1.0

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

Course Outline. Introduction to java

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

Job Ready Assessment Blueprint. Computer Programming. Test Code: 3023 / Version: 01

Chapter1 Overview of computers

CSC 121 Spring 2017 Howard Rosenthal

PROBLEM SOLVING AND OFFICE AUTOMATION. A Program consists of a series of instruction that a computer processes to perform the required operation.

Visual Basic Course Pack

Computer Fundamentals

Using Visual Basic Studio 2008

An Introduction to Python (TEJ3M & TEJ4M)

Visual Basic Program Coding STEP 2

Visual C# Program: Temperature Conversion Program

Students received individual feedback throughout year on assignments.

Introduction to C Final Review Chapters 1-6 & 13

FLOW CHART AND PSEUDO CODE

Chapter 5 Conditional and Iterative Statements. Statement are the instructions given to the computer to perform any kind of action.

ENT 189: COMPUTER PROGRAMMING. H/P: Home page:

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and

I101/B100 Problem Solving with Computers

ITC213: STRUCTURED PROGRAMMING. Bhaskar Shrestha National College of Computer Studies Tribhuvan University

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

CS 105 Lab As a review of what we did last week a. What are two ways in which the Python shell is useful to us?

Overview About KBasic

Unit II. (i) Computer Programming Languages

Making Tables and Figures

Contents. More Controls 51. Visual Basic 1. Introduction to. xiii. Modify the Project 30. Print the Project Documentation 35

Departme and. Computer. CS Intro to. Science with. Objectives: The main. for a problem. of Programming. Syntax Set of rules Similar to.

END-TERM EXAMINATION

Basics of Spreadsheet

Skill Area 306: Develop and Implement Computer Program

HOUR 4 Understanding Events

CIS 3260 Intro. to Programming with C#

PROBLEM SOLVING AND PYTHON PROGRAMMING

Programming Logic Beginning

Pseudo Code and Flow Charts. Chapter 1 Lesson 2

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures

LESSON B. The Toolbox Window

Skill Area 336 Explain Essential Programming Concept. Programming Language 2 (PL2)

Pseudocode. ARITHMETIC OPERATORS: In pseudocode arithmetic operators are used to perform arithmetic operations. These operators are listed below:

Microsoft Excel 2010 Handout

UNIT 1. Introduction to Microsoft.NET framework and Basics of VB.Net

19 Much that I bound, I could not free; Much that I freed returned to me. Lee Wilson Dodd

Condition Controlled Loops. Introduction to Programming - Python

Unit E Step-by-Step: Programming with Python

Introduction to Computers and Java

Chapter 3 Syntax, Errors, and Debugging. Fundamentals of Java

PSEUDOCODE AND FLOWCHARTS. Introduction to Programming

You can record macros to automate tedious

IT 374 C# and Applications/ IT695 C# Data Structures

FUNDAMENTALS OF COMPUTING & COMPUTER PROGRAMMING UNIT III. 2 Marks PROBLEM SOLVING AND OFFICE AUTOMATION

Tutorial 03 understanding controls : buttons, text boxes

Lab Cover Page. Lab Date and Time: Teaching Assistant to whom you are submitting

Control Statements: Part 1

Fundamentals of Programming (Python) Getting Started with Programming

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Subject to Change Drawing Application 1 Introducing Computers, the Internet and C#

Programming for Engineers Iteration

Introduction to Java Applications

Microsoft Visual Basic 2005: Reloaded

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

1) Which of the following is an example of a programming language? 1) A) Microsoft Word B) English C) HTML D) Java

Using Microsoft Excel

Chapter 3 Problem Solving and the Computer

Programming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.

Dive Into Visual C# 2008 Express

Advanced Financial Modeling Macros. EduPristine

Lesson 3: Basic Programming Concepts

3 The L oop Control Structure

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

VALLIAMMAI ENGINEERING COLLEGE

Sri Vidya College of Engineering & Technology

WYSE Academic Challenge 2017 Software Changes

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

Outline. Debugging. In Class Exercise Solution. Review If Else If. Immediate Program Errors. Function Test Example

EPANET Tutorial. Project Setup Our first task is to create a new project in EPANET and make sure that certain default options are selected.

Microsoft Office 2003 Beginning Microsoft Word

VBA Excel 2013/2016. VBA Visual Basic for Applications. Learner Guide

Visual Basic 2008 Anne Boehm

ICT GRAND WORKSHEET- CLASS-5. Section A. 2 nd Term Chapters 5, 6, 7, 8 and 9. Fill in the blanks with the correct answers.

University of Massachusetts Lowell

Lab 4: Introduction to Programming

Chapter 1. Introduction to Computers and Java Objects. Background information. » important regardless of programming language. Introduction to Java

Measures of Central Tendency. A measure of central tendency is a value used to represent the typical or average value in a data set.

A Freshman C++ Programming Course

Programming Logic - Beginning

Module 1: Introduction to Computers, Programs, and Java

A triangle that has three acute angles Example:

ECE 202 LAB 3 ADVANCED MATLAB

Essay & Assignment Preparation using MindGenius

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

A Quick Tour GETTING STARTED WHAT S IN THIS CHAPTER?

Microsoft Visual Basic 2005: Reloaded

Transcription:

1

Information system An information system is the combination of technology(computers) and people that enable an organization to collect data, store them, and transform them into information Data Data are raw facts that are collected and stored by the information system (numbers, letters, images, sound clips, or video clips) Information Is the output data processing (example the level of sugar in the blood) Computer Operations 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 Programming is a form of problem solving which aim is to develop a step by step process (logic) to solve the problem. The step by step logic is referred to as Algorithm Programming Languages like BASIC enable people to write programs in English-like languages that a BASIC interpreter or BASIC compiler can change into the machine language that the computer can understand 2

high-level languages Program Programming languages to write letters in English, but different rules change from one language to Other Sum = 0 Counter = 0 machine language which is entirely composed of zeroes and ones 1001100101010101 Interpreter When a program is interpreted, the high-level language statements are converted into equivalent machine-language statements one at a time as the program is executed. The nice thing about interpreting a program is that, if the program encounters a statement with an error, the interpretation process stops and an error message is displayed so the user can correct it. On the other hand, executing an interpreted program is slower than executing a compiled program since each statement has to be converted to binary each time it is encountered in the program even if it When a high-level language is compiled, the entire program is translated into machine language before any attempt to execute it. Compilation has an advantage over interpretation in that a compiled program will run faster than an interpreted program once all errors have been found and corrected. Note that, errors are more difficult to find during compilation than during interpretation 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. 3

Questions: Q1. Define an information system.? Q2. What is the difference between data and information? Q3. How you can convert data into information? Q4. Mention the main operations that all computers can perform. Q5. What is the difference between high level languages and machine language? Q6. What is the difference between compiler and interpreter? 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. 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 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). 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. 4

Flowcharting A flowchart is a diagrammatic representation that illustrates the sequence of operations to be performed to get the solution of a problem. Note that the 5 basic flowcharting symbols are 1 -Terminal block 2-Input / Output 3- Process block 4- Decision block 5- Flow lines. ADVANTAGES OF USING FLOWCHARTS 1. Communication 2. Effective analysis 3. Proper documentation 4. Efficient coding 5. Proper debugging 6. Efficient program maintenance LIMITATIONS OF USING FLOWCHARTS 1. Complex logic 2. Alterations and modifications 3. The essentials of what is done can easily be lost in the technical details of how it is done. 5

4. The difficulty of coping Pseudocode Pseudocode is statements written in abbreviated form to show the steps required to solv Pseudocode means "false code". That means that it is not the programming language e a specific problem Components 1. Words 2. Clauses 3. Statements 1-If hours worked is greater than 150 Then Calculate Overtime Pay = (Hours Worked 150) * 1.5 * (Pay Rate) Calculate Gross Pay = 150 * (Pay Rate) + Overtime Pay Else 2-Calculate Gross Pay = (Pay Rate) * (Hours Worked) Calculate TAX = 0.20 * (Gross Pay) Rules and Constraints 1. The data names of variables being used to solve the problem should describe what the variable represents 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 In this case an IF statement is presented There can be only 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 - 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 For example M = 25 N = 12 If ( M >= N ) Then Statement 1 Else Statement 2 6

End If Statement 3 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 1- Initialize the sum: Sum = 0 2- Initialize the number of terms N: N = 0 3- Increment the number of terms N 4- Add the new term to Sum: Sum = Sum + N 5- If (N = 100 ) Then Go to step 6 Else Perform steps 3 through step 4 until N = 100 Iterations End If 6- Stop Processing Advantages and disadvantages of Pseudocode Some of advantages of pseudocode are : 1. It is simple because it uses English-like statements. 2. No special symbols are used. 3. No specific syntax is used. 4. It is very easy to translate its statements to that for high level languages on a one-for-one basis The main disadvantages of pseudocode is that : 1. It can be quite lengthy for complex problems 7

Draw flowchart to represent the process of reading two numbers, dividing them, and then displaying the result Write a pseudocode to represent the process of reading two numbers, dividing them, and then displaying the result. 1. Input (Read) the first number number1. 2. Input (Read) the second number number2. 3. IF the value of number2 = zero Then Print Division is impossible because number2 is zero Go to step 4 ELSE result = number1 / number2 Print number1, number2, and result END IF 4. Stop processing. 8

Draw a flowchart to find the largest of three numbers A, B, and C. Write a pseudocode to find the largest of three numbers A, B, and C. 1. Input (Read) the values of three numbers A, B, C 2. IF the value of A > that of B Then Go to step 3 ELSE Go to step 4 END IF 3. IF the value of A > that of C Then Print The maximum value is that of A Go to step 5 ELSE Print The maximum value is that of C Go to step 5 END IF 4. IF the value of B > that of C Then Print The maximum value is that of B Go to step 5 ELSE Print The maximum value is that of C 5. Stop processing 9

END IF Draw a flowchart 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 + + 99 + 100. Write a pseudocode 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 + + 99 + 100 1. Initialize the Sum: Sum = 0 2. Initialize the term number N, which is the term itself: N = 0 3. Increment the term number: N = N + 1 4. Add the new term to Sum: Sum = Sum + N 5. IF N= 100 Then Go to step 6 Else Perform steps 3 through 4 until N is equal to 100 END IF 10

6. Print an output line showing the sum of the first 100 terms of the series 7. Stop processing Draw a flowchart to find the sum of the first 25 odd natural numbers. This means that we want to find sum where sum is given by: Sum = 1 + 3+ 5 + here we add 25 odd natural numbers 11

Write a pseudocode to find the sum of the first 25 odd natural numbers. This means that we want to find sum where sum is given by: Sum = 1 + 3+ 5 + here we add 25 odd natural numbers 1. Initialize the Sum: Sum = 0 2. Initialize the number of terms N, and the first term T: N = 0 T = 1 3. Add the new term to Sum: Sum = Sum + T 4. Increment the number of terms by 1, and the term value by 2: N = N + 1 T = T + 2 5. IF N = 25 Then Go to step 6 Else Perform steps 3 through 4 until T is less than 0.01 END IF 6. Print an output line showing the sum of the first 25 odd terms of the series 7. Stop processing T=0 + + + T=1 12

Draw a flowchart to read the age of Hany and Hesham, then it prints the name of the elder Write a pseudocode to read the age of Hany and Hesham, then it prints the name of the elder 1- Input Hany is age and Hesham is age 2- If Hany is age Hesham is age Then Print Hany is elder Else If Hany is age = Hesham is age Then Print Both is equal Else Print Hesham is elder End If End If 3- Stop processing 13

Draw a flowchart that reads a temperature in Fahrenheit degrees and convert it into Celsius degrees, using the formula Write a pseudocode that reads a temperature in Fahrenheit degrees and convert it into Celsius degrees, using the formula 1- Initialize Celsius Degree C : C = 0 2- Input (Read) Fahrenheit Degree F 3- C = 5/9 * (F 32) 4- Print the value of C 14

5- Stop processing Draw a flowchart that reads the radius of a sphere r, then it calculates its volume V and surface area A using formulas If the read radius is negative, the flowchart should print a warning message then terminates Print the radius should be positive 15

Draw a flowchart that reads the radius of a sphere r, then it calculates its volume V and surface area A using formulas If the read radius is negative, the flowchart should print a warning message then terminates 1- Initialize Volume V : V = 0 2- Initialize Area A : A = 0 2- Input (Read) Radius r 3- If r < 0 Then Print the radius should be positive Else V = (4 / 3) * (22 / 7) * (r ^ 3) A = 4 * (22 / 7) * (r ^ 2) Print The Volume of Ball is V Print The Area of Ball is A End If 5- Stop Processing Object Oriented Programming (OOP) In the OOP model, programs are no longer procedural. They do not follow a sequential logic. You, as the programmer, do not take control and determine the sequence of execution. Instead, the user can press keys and click various buttons and boxes in a window. Each user action can cause an event to occur, which triggers a basic procedure (function or program) that you have written Object is something that exists. We deal with objects in our daily life. In real world objects can be parts of other objects. Property as a characteristic or attribute of an object. ObjectName.Property = Value MyPen.Color =Blue Method 16

as a predefined actions provided with an object. ObjectName.Method() Event as an action that may be caused by the user, such as a click, drag, or key press Classes a prototype or blueprint for an object that includes the specifications for its properties and methods. (Encapsulation) as 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 as (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 Fill in the spaces using the following words : ( inheritance- object- event- property- method- class- Encapsulation) 1. Clicking the Mouse inside a 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 5- methods 1- event 6- properties 2- properties 7- class 3- event 8- encapsulation 4- inheritance Put ( ) in front of the right sentence and ( ) in front of the wrong sentence: 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, Methods, and Events. (..) 7- Object is constructed out of a Class. (..) 17

8- Encapsulation is used to hide information of the Class. (..) 9- Derived Class inherits from the Base Class properties only. (..) 10- Encapsulation is used to protect the information of the Class.(..) - - - - - - - - - - Fill the following table Mnemonic object properties methods events class (oop) encapsulation inheritance Means is something that exists. We deal with objects in our daily life. In real world objects can be parts of other objects. as a characteristic or attribute of an object. as a predefined actions provided with an object. as an action that may be caused by the user, such as a click, drag, or key press a prototype or blueprint for an object that includes the specifications for its properties and methods In the OOP model, programs are no longer procedural. They do not follow a sequential logic. You, as the programmer, do not take control and determine the sequence of execution. Instead, the user can press keys and click various buttons and boxes in a window. Each user action can cause an event to occur, which triggers a basic procedure (function or program) that you have written as 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 as 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 18

( IDE )Integrated Development Environment The Visual Studio Environment is where you create and test your projects. The development environment is called the Integrated Development Environment (IDE). VB Projects Editor / Compiler / Debugger / Object browser / Help Open program VB.Net Start All Program Visual Basic2005 The New Project Dialog In the New Project dialog, select Visual Basic and Windows in the Project Types, then select Windows Application in the Templates box. In addition to that you have to give your project a name on this dialog box The IDE main window Toolbar: The Visual Studio toolbars contain buttons that are shortcuts for menu commands. The standard toolbar is shown Form Designer: The Form Designer is where you design a form that makes your user interface Solution Explorer : The Solution Explorer window holds the files names for the files included in your project and a list of the classes it references Properties window: We use the Properties Window to set the properties of objects in your Toolbox: The Toolbox contains the tools you use to place controls on a form : v.b.net 2005 Save all The Windows Form Control When you create a Windows Application new project, the IDE will automatically create a "Windows Form" for you as you have seen in the previous chapter. Practically, you will use this form to hold the other controls Button It was mentioned in the previous chapter that the Button control's 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 19 F5 File

( Hint) Gets or sets the image that is displayed on a Button control Gets or sets the alignment of the image on the Button control Gets or sets the alignment of the text on the Button control Gets or sets a value indicating whether the control is displayed ( Property) Image ImageAlign TextAlign Visible Visible Button1.Visible=False Button1.Visible=True True True Button Button1.Visible=False. Button1. False Button1.Enabled=False Button1.Enabled=True Label The Label control is a rectangular area that can be filled with text. The following Table provides a list of commonly used properties for : :. :Visible False :Enabled 20

Empty String("") We set this Label's Text property equal to the empty string at design time so that when the application starts running, Events As we discussed before, when the user clicks the mouse button, Click event is generated. You can write a code that is executed when the event of clicking the button is detected. This code is called event handler Intell Sense IntelliSense list of the controls by using the "Me" keyword. When you type "Me" followed by a period, a list pops up showing the objects, properties, and methods for the form. As you start to type the control name, the selected position in the list changes until the unique item appears, then as soon as the correct name appears, type the next character(space, period, or Enter key) Textbox The TextBox is a data entry control. It provides an area for the user to type while the program executes. This information can then be used by the application's code as it executes. 21

"CharacterCasting" property will automatically change whatever the user types to either uppercase or lowercase. "MaxLength" property controls the maximum number of characters the user can type. "ReadOnly" property prevents the user from typing into the TextBox, when it is set to True "PasswordChar" property lets you set a character "TextLength" property is used during run time to see how many characters exist in the TextBox MsgBox MsgBox statement stands for Message Box statement. It is an alternative way to the label control for displaying information to the user Button1.Text = "Cairo" Button1.ForeColor = Color. Red Button1.BackColor = Color. Yellow MsgBox("Egypt") Label5. Text Align=Center Button1.Visible=True Button1.Visible=False Button1.Enabled=True Button1.Enabled=False Capital TextBox1.Text=Me. TextBox2.Text.ToUpper( ) Small TextBox2.Text=Me. TextBox1.Text.ToLower( ) / 22