Chapter1_Intro

# S gannouni dr a touir introduction to oop defining the

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: am. – Compile the program. – Run the program. – Test and debug the program. Page 7 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Defining the Problem • The problem must be defined in terms of: – Input: Data to be processed. – Output: The expected result. • Look for nouns in the problem statement that suggest output and input. – and processing: The statements to achieve. • Look for verbs to suggest processing steps. output data input data Keyboard Page 8 Processing Dr. S. GANNOUNI & Dr. A. TOUIR Screen Introduction to OOP Input and Output • Inputs – Can come from many sources, such as users, files, and other programs – Can take on many forms, such as text, graphics, and sound • Outputs – Can also take on many forms, such as numbers, text, graphics, sounds, or commands to other programs Page 9 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Example 1 Area and Perimeter of a rectangle • Input – Length – width • Processing – Area = length*width – Perimeter = 2*( length + width) • Output – Area – Perimeter Page 10 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Example 2 Sum and Average of 5 numbers • Input – five number x1, x2, x3, x4, x5 • Processing – Sum = x1+x2+x3+x4+x5 – Average = Sum/5 • Output – Sum – Average Page 11 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Example 3 Area and Perimeter of a circle • Input – Radius – PI • Processing – Area = PI * Radius * Radius – Perimeter = 2 * PI * Radius • Output – Area – Perimeter Page 12 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Planning the Solution • When planning, algorithms are used to outline the solution steps using Englishlike statements, called pseudocode. Page 13 Dr. S. GANNOUNI & Dr. A. TOUIR Introduction to OOP Coding the Program • Coding is writing the program in a formal language called Programming Language. • Programming Language : A set of rules, symbols and special words...
View Full Document

## This document was uploaded on 03/03/2014.

Ask a homework question - tutors are online