basic problem solving csc 111. learning objectives in this lecture we will learn 1. basic steps for...
TRANSCRIPT
![Page 1: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/1.jpg)
BASIC PROBLEM SOLVING
CSC 111
![Page 2: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/2.jpg)
2
Computer Programming -1
Learning Objectives
In this lecture we will learn
1. Basic steps for designing computer program
2. Algorithm
3. Flow Chart
![Page 3: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/3.jpg)
Computer Programming -1
3
Solving Problems Stages
1. Problem Definition Define the main Problem
2. Problem Analysis Determine the inputs, outputs, Arithmetic &
logic operations
3. Design Solution Identify the required step for computer to do
![Page 4: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/4.jpg)
Computer Programming -1
4
Problem Definition
Write a Program to Print the Sum of two integer Numbers
Write a program to Print the Average of three integer numbers
Write a program to print the volume of a cube and the sum of it’s surfaces’ areas
![Page 5: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/5.jpg)
Computer Programming -1
5
Problem Analysis
Write a Program to Print the Sum of two integer Numbers
Inputs :First NumberSecond Number
Operations :Summation = first + second
Output :The summation
![Page 6: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/6.jpg)
Computer Programming -1
6
Problem Analysis
Write a program to Print the Average of three integer numbers
Inputs :First Number
Second Number
Third Number Operations :
Average = (first + second + third ) / 3 Output :
The Average
![Page 7: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/7.jpg)
Computer Programming -1
7
Problem Analysis
Write a program to print the volume of a cube and the sum of it’s surfaces’ areas
Inputs :1. Side Length
Operations : Volume = side * side * side Surface area = ( side * side ) * 6
Output :1. The Volume
2. The surface area
![Page 8: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/8.jpg)
Computer Programming -1
8
Solving Problems Stages
Problem Definition
Problem Analysis
Solution DesignDesign a solution for the problem by writing an algorithm or drawing a flow chart
Algorithm
Flow Chart
![Page 9: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/9.jpg)
Computer Programming -1
9
Basic steps for designing a solution
Read all the inputs
Calculate operations
Print the output
![Page 10: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/10.jpg)
Computer Programming -1
10
Algorithms
Write a Program to Print the Sum of two integer Numbers
1. Start the program2. Read the first number and save in the variable ( N1 )3. Read the second number and save in the variable ( N2 )4. Sum the both numbers and save the result in the
variable ( Sum ) Sum = N1 + N2 5. Print the variable ( Sum ) 6. End the program
![Page 11: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/11.jpg)
Computer Programming -1
11
Algorithms
Write a program to Print the Average of three integer numbers
1. Start the program2. Read the first number and save in the variable ( num1 )3. Read the second number and save in the variable ( num2 )4. Read the third number and save in the variable ( num3 )5. Sum the three numbers and save the result in the variable
( result ) result = num1 + num2 + num36. Divide the variable ( result ) by 3 and save the result in
variable ( Average ) Average = result / 3 7. Print the variable ( Average )8. End the program
![Page 12: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/12.jpg)
Computer Programming -1
12
Algorithms
Write a program to print the volume of a cube and the sum of it’s surfaces’ areas
1.Start the program
2.Read the length of the side and save in variable ( Length )
3.Volume = Length * Length * Length
4.Surface = ( Length * Length ) * 6
5.Print the variable ( Volume )
6.Print the variable ( Surface )
7.End the program
![Page 13: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/13.jpg)
13
Computer Programming -1
Flow Chart
![Page 14: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/14.jpg)
Java Programming: From Problem Analysis to Program Design, Third Edition
14
Flow chart’s Symbols
Loops
Start/End
Read/Print
Arithmetic Operations
Decision
Connectors arrows
Connectors points
Comments
Start
Read n1
N2 = 5
End
Print n1
N2 = n1+3
n1 > 3
//my name
![Page 15: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/15.jpg)
Computer Programming -1
15
Simple Sequential Flow Charts
start
End
![Page 16: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/16.jpg)
Computer Programming -1 16
16
Write a Program to Print the Sum of two integer Numbers
1. Start the program2. Read the first number and save in
the variable ( N1 )3. Read the second number and save
in the variable ( N2 )4. Sum the both numbers and save
the result in the variable ( Sum ) Sum = N1 + N2
5. Print the variable ( Sum ) 6. End the program
start
Read N1
Read N2
Sum = N1 + N2
Print Sum
End
![Page 17: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/17.jpg)
17
17
Computer Programming -1
Write a program to print the volume of a cube and the sum of it’s surfaces’ areas
1. Start the program2. Read the length of the side and
save in variable ( Length )3. Volume = Length * Length * Length4. Surface = ( Length * Length ) * 65. Print the variable ( Volume ) 6. Print the variable ( Surface )7. End the program
start
Read L
&ٍSurface = ( L * L ) * 6
Print Volume
End
Volume = L * L * L
Print Surface
![Page 18: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/18.jpg)
Computer Programming -1 18
18
Write a program to Print the Average of three integer numbers
start
Read num1
Read num2
result = num1+num2+num3
Print Average
End
Read num3
Average = result/3
start
Read num1,num2,num3
result = num1+num2+num3
Print Average
End
Average = result/3
![Page 19: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/19.jpg)
Computer Programming -1 19
19
Write a program to Print the Average of three integer numbers
start
Read num1,num2,num3
Average = ( num1+num2+num3 ) / 3
Print Average
End
![Page 20: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/20.jpg)
Computer Programming -1 20
20
Write a program to Print the Average of three integer numbers
start
Read num1
Read num2
Print Average
End
Read num3
Average = result/3
result = num1+num2+num3
start
Read num3
Read num1
result = num1+num2+num3
Print Average
End
Read num2
Average = result/3
![Page 21: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/21.jpg)
Computer Programming -1 21
21
Write a program to Print the Average of three integer numbers
start
Read num1,num2,num3
result = num1+num2+num3
Print result
End
Average = result/3
start
Read num1,num2,num3
Print result
End
Average = result/3
result = num1+num2+num3
Print Average
![Page 22: BASIC PROBLEM SOLVING CSC 111. Learning Objectives In this lecture we will learn 1. Basic steps for designing computer program 2. Algorithm 3. Flow](https://reader035.vdocument.in/reader035/viewer/2022070403/56649f2a5503460f94c44ea5/html5/thumbnails/22.jpg)
Computer Programming -1
22
Summery
A problem-solving process for programming has five steps: analyze the problem, design an algorithm, implement the algorithm in a programming language, verify that the algorithm works, and maintain the program.
An algorithm is a step-by-step problem-solving process in which a solution is arrived at in a finite amount of time.
A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows.