Lecture 4 Problem Solving concepts Overview Learning Objectives
Lecture 4 Problem Solving concepts
Overview • • • Learning Objectives Learning Outcomes Functions Expressions and Equations Summary
Learning Objectives • To explain functions. • To identify use of functions • To write an expression and equations
Learning Outcomes • The Students are able to: • Use the different functions. • Use of an expression and equations
Functions • Function is a small sets of instructions that perform specific tasks and returns values • They are usually built in for computer language • The form of function is the name of function followed by open parenthesis ( followed by data needed and concluded by a closed parenthesis ). • Ex. Functionname(data) • sqrt(n)
Functions • They are divided into five classes: 1. Mathematical Functions: 2. String Functions: 3. Conversion Functions 4. Statistical Functions 5. Utility Functions
0 -7
0 -8
0 -9
0 -10
Expressions and Equations • Expressions and Equations make up part of the instructions in the solution to computer problem • Expression processes data, operands, through use of operators Ex. Base * Height • Equation stores the resultant of an expression in memory location in computer through the = sign Ex. Area = Base * Height
Hierarchy of Operations 0 -12
Hierarchy of Operations 0 -13
Summary • Use of functions. • Use of expressions and equations
a. X Home Assignment I. Evaluate for A=5, B=3, C=2. a. F=A * C ( A + C ) b. F= ( C * ( B + 3 * A ) + 5 * A ) * C 2. Evaluate the following equations, given A = False, B = True, C = False, D = True. (Include the structure of the order of processing a. R = A AND B OR C AND D b. R = NOT (A AND B) OR NOT (D AND C)
a. X Home Assignment
a. X Home Assignment Evaluate the following equations, given the values A = 3, B = 3, C = 6, D = 2: a. F = A + B/C - D ^ 2 b. F = (A + B)/ C - D ^ 2
a. X Important Questions • Define function. And explain its types. And give example • Explain hierarchy of operations
a. X Great Thought
- Slides: 19