0% found this document useful (0 votes)
41 views25 pages

Week 1

This document contains a lesson plan on program logic formulation for a fundamentals of computing course. It defines computer programming and its basic logic operations. It also outlines the typical phases of writing computer programs, including understanding the problem, designing a solution, writing an algorithm using pseudocode, and more. Sample problems are provided to demonstrate how to write the output, input, process and pseudocode for problems involving calculating sums, circumferences, and more.

Uploaded by

Fernan Enad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views25 pages

Week 1

This document contains a lesson plan on program logic formulation for a fundamentals of computing course. It defines computer programming and its basic logic operations. It also outlines the typical phases of writing computer programs, including understanding the problem, designing a solution, writing an algorithm using pseudocode, and more. Sample problems are provided to demonstrate how to write the output, input, process and pseudocode for problems involving calculating sums, circumferences, and more.

Uploaded by

Fernan Enad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

SAN AGUSTIN NATIONAL HIGH SCHOOL

Senior High School Department


Fundamentals of Computing

Week 1: Program Logic


Formulation
FERNANDO B. ENAD
PhD, MSc, FMERU, FMERC, LPT
Faculty Member, Senior HS Department
San Agustin NHS
DEPARTMENT OF EDUCATION
Day 1
Week 1: Program Logic Formulation
Outline

• Computer Programming Defined


• Phases in Writing Computer Programs
• Sample Exercises

DEPARTMENT OF EDUCATION
Computer Programming Defined

• Computer
– A high-speed electronic device capable of accepting inputs,
processing data, storing information, and producing outputs.
• Program
– A step-by-step instructions for a computer to execute.

DEPARTMENT OF EDUCATION
Computer Programming Defined

• Computer Programming
– A process of writing step-by-step instructions for a computer to
execute.
– The goal is to think like computers to be able to properly write
instructions.

DEPARTMENT OF EDUCATION
Computer Programming Defined

• Basic Computer Logic


– 1+1=2
Integer division. Drop remainder.
– 2–1=1
– 2*1=2
Real number division. Decimal digits
– 4/4=1 are significant.
– 5/3=1
– 5.0 / 3 = 1.667
– 5 / 3.0 = 1.667
– 5.0 / 3.0 = 1.667 Modulo division. Only the remainder is
considered. Only applicable to integer
– 5%3=2 numbers.

DEPARTMENT OF EDUCATION
Computer Programming Defined

• Phases in Writing Computer Programs


– Understand the problem/specifications
– Design a solution
– Write the algorithm: flow chart, pseudocode
– Translate algorithm to actual programming language code
– Test and debug
– Test with real-world users
– Release the program

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Phases in Writing Computer Programs


– Understand the problem/specifications Current Focus
– Design a solution
– Write the algorithm: flow chart, pseudocode
– Translate algorithm to actual programming language code
– Test and debug
– Test with real-world users
– Release the program

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given 2 numbers, compute and display sum.


1. Understand the problem
2 numbers are to be inputted to solve for the sum

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given 2 numbers, compute and display sum.


1. Understand the problem
2 numbers are to be inputted to solve for the sum
2. Designing a solution
Output: sum
Input: x, y (2 numbers)
Process: sum = x + y

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given 2 numbers, compute and display sum.


1. Understand the problem
2 numbers are to be inputted to solve for the sum
2. Designing a solution
3. Writing algorithm: (pseudocode)
Output: sum Verbs: Start, Input, =, Output, Stop
Input: x, y (2 numbers)
Start
Process: sum = x + y Input x
Input y
sum = x + y
Output sum
Stop
DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given 2 numbers, compute and display sum.


1. Understand the problem
2 numbers are to be inputted to solve for the sum
2. Designing a solution
3. Writing algorithm: (pseudocode)
Output: sum Verbs: Start, Input, =, Output, Stop
Input: x, y (2 numbers)
Start 3
Process: sum = x + y Input x
7
Input y
sum = x + y 3+7
Output sum 10
Stop
DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output:
Input:
Process:

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference
Input:
Process:

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference
Input: r (radius)
Process:

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference
Input: r (radius)
Process:

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference Pseudocode
Input: r (radius)
Process: Start

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference Pseudocode
Input: r (radius)
Process: Start
Input r

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference Pseudocode
Input: r (radius)
Process: Start
Input r
c = 2 * 3.1416 * r

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference Pseudocode
Input: r (radius)
Process: Start
Input r
c = 2 * 3.1416 * r
Output c

DEPARTMENT OF EDUCATION
Phases in Writing Computer Programs

• Given the radius, compute and display the circumference


Output: circumference Pseudocode
Input: r (radius)
Process: Start
Input r
c = 2 * 3.1416 * r
Output c
Stop

DEPARTMENT OF EDUCATION
Activity

• Task 1: Submit assignment

DEPARTMENT OF EDUCATION
Activity

• Task 2: 1/2 whole sheet. Provide the OIP (output, input,


process) and the pseudocode for the following problems.
1. Given a base, compute and display for the product after
raising it to the power 5.
2. Given the temperature in C, compute and display the
corresponding temperature in F.

DEPARTMENT OF EDUCATION
Computer Programming Defined

• Basic Computer Logic


– ⌊ 5.0 / 2 ⌋ = 2
Floor. Drops the decimal digits.
– ⌈ 3.0 / 2 ⌉ = 2

Ceil. Rounds up regardless of the


decimal digits.

DEPARTMENT OF EDUCATION
Assignment

• 1 whole sheet. Provide the OIP (output, input, process) and


pseudocode for the following problems.
1. N students take K apples and distribute them among each
other evenly. The remaining (the undivisible) part remains in
the basket. How many apples will each single student get?
How many apples will remain in the basket?
2. A timestamp is three numbers: a number of hours, minutes
and seconds. Given two timestamps, calculate how many
seconds is between them. The moment of the first timestamp
occurred before the moment of the second timestamp.

DEPARTMENT OF EDUCATION

You might also like