You are on page 1of 10

DE LA SALLE JOHN BOSCO COLLEGE

Mangagoy, Bislig City


COLLEGE OF COMPUTER STUDIES

Module Number 1
Module Description Introduction to Programming 1
Duration 6 hours and 30 minutes
Week Number 1
Date Aug. 17 – 21, 2020

Objectives:
1. Understand what computer programming is.
2. Understand and apply algorithms in programming problems and exercises.
3. Understand and apply flowchart in programming problems and exercises.

Introduction

Think about some of the different ways that people use computers. In school, students use computers for
tasks such as writing papers, searching for articles, sending email, and participating in online classes. At
work, people use computers to analyze data, make presentations, conduct business transactions,
communicate with customers and coworkers, control machines in manufacturing facilities, and do many
other things. At home, people use computers for tasks such as paying bills, shopping online,
communicating with friends and family, and playing computer games. And don’t forget that cell phones,
iPods, Blackberries, car navigation systems, and many other devices are computers too. The uses of
computers are almost limitless in our everyday lives.

Computers can do such a wide variety of things because they can be programmed. This means that
computers are not designed to do just one job, but to do any job that their programs tell them to do. A
program is a set of instructions that a computer follows to perform a task.

Programs are commonly referred to as software. Software is essential to a computer because it controls
everything the computer does. All of the software that we use to make our computers useful is created by
individuals working as programmers or software developers. A programmer, or software developer, is a
person with the training and skills necessary to design, create, and test computer programs.

According to Steve Jobs


“Everyone should know how to program a computer, because it teaches you how to think.”

According to one anonymous programmer


“Nobody cares how it works as long as it worked. That’s how it is with people.”

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

DISCUSSION

What is Computer Programming?

Programming is the process of designing and building an executable computer program that carries out
a given computing task.

At its most basic definition, computer programming is a set of instructions to facilitate specific actions.
Computer programmers create instructions for a computer to execute by writing and testing code that
enables applications and software programs to operate successfully.

The Program Development Cycle

1. Problem Definition
A programmer is usually given a task in the form of a problem. Before a program can be designed
to solve a particular problem, the problem must be well and clearly defined first in terms of its
input and output requirements.

A clearly defined problem is already half the solution. Computer programming requires us to
define the problem first before we even try to create a solution.

Problem1: Create a program that will let the user input two numbers and display its sum.
Answer: What is ask?
1. A java program that will let the user input two numbers.
2. The same java program that will display the sum of two numbers inputted
by the user.

Problem2: Create a java program that will let the user input its name and age.
Answer: What is ask?
1. A java program that will let the user input its name.
2. The same java program that will let the user input its age.

Problem3: Create a java program that will let the user input its name and age, and then display the
name and age.
Answer: What is ask?
1. A java program that will let the user input its name.
2. The same java program that will let the user input its age.
3. The same java program that will display the name and age of the user.

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

2. Problem Analysis
After the problem has been adequately defined, the simplest and yet the most efficient and
effective approach to solve the problem must be formulated.

Usually, this step involves breaking up the problem into smaller and simpler sub-problems.

Problem1: Create a program that will let the user input two numbers and display its sum.
Answer:
Input Process Output
1. Enter num1. 3. Calculate the sum of two 4. Display sum.
2. Enter num2. numbers.

Problem2: Create a java program that will let the user input its name and age.
Answer:
Input Process Output
1. Enter name. None None
2. Enter age.

Problem3: Create a java program that will let the user input its name and age, and then display the
name and age.
Answer:
Input Process Output
1. Enter name. None 3. Display name.
2. Enter age. 4. Display age.

3. Algorithm Design and Representation


An algorithm is a procedure consisting of a finite set of unambiguous rules (instructions) which
specify a finite sequence of operations that provides the solution to a problem, or to a specific
class of problems for any allowable set of input quantities (if there are inputs). In other word, an
algorithm is a step-by-step procedure to solve a given problem

Problem1: Create a program that will let the user input two numbers and display its sum.
Algorithm:
1. Enter num1.
2. Enter num2.
3. Calculate the sum of two numbers using the formula

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

sum = num1 + num2


4. Display sum.

Problem2: Create a java program that will let the user input its name and age.
Algorithm:
1. Enter name.
2. Enter age.

Problem3: Create a java program that will let the user input its name and age, and then display the
name and age.
Algorithm:
1. Enter name.
2. Enter age.
3. Display name.
4. Display age.

HOME EXERCISES.
Direction: Define the problem, analyze the problem using the IPO format, and then write its
equivalent algorithm.

1. Write a Java program that prints “Hello World” to the screen.

2. Write a Java program that let the user input 3 numbers and then display its sum and product.

3. Write a Java program that let the user input any number and display its modulo of 2.

4. Write a Java program that display the reversed of “HELLO WORLD”.

5. Write a Java program that will the user input 4 numbers and then display the sum of first
number and second number, display the difference of third number and fourth number,
display the product of first number and third number, and then display the quotient of second
and fourth number.

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

FLOWCHART

A flowchart is a graphical representation of steps. It was originated from computer science as a tool for
representing algorithms and programming logic but had extended to use in all other kinds of processes.
Nowadays, flowcharts play an extremely important role in displaying information and assisting
reasoning. They help us visualize complex processes, or make explicit the structure of problems and
tasks. A flowchart can also be used to define a process or project to be implemented.

BASIC SYMBOLS OF FLOWCHART

Symbol Name Action Represented

Terminal Symbol Represent start and end of the program.

Flow Line This shows the flow of the program.

Input/Output Symbol Indicates input and output.

Process Symbol This represent processing of action.

This is used for initialization of values and


Initialization Symbol
allocation of memory.

This symbol is used for decision making which


Decision Symbol
requires a yes/no response or true/false.

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

EXAMPLE OF FLOWCHARTING

Problem1: Create a program that will let the user input two numbers and display its sum.

Start

Enter num1
Enter num2

Calculate the sum

sum = num1 + num2

Display sum

End

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

Problem2: Create a java program that will let the user input its name and age.

Start

Enter name
Enter age

End

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

Problem3: Create a java program that will let the user input its name and age, and then display the name
and age.

Start

Enter name
Enter age

Display name
Display age

End

HOME EXERCISES
Direction: Draw the equivalent flowchart of each problem.

1. Write a Java program that prints “Hello World” to the screen.


2. Write a Java program that let the user input 3 numbers and then display its sum and product.
3. Write a Java program that let the user input any number and display its modulo of 2.
4. Write a Java program that display the reversed of “HELLO WORLD”.
5. Write a Java program that will the user input 4 numbers and then display the sum of first
number and second number, display the difference of third number and fourth number,
display the product of first number and third number, and then display the quotient of second
and fourth number.

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

ACTIVITY/SKILL EXERCISES

SKILL EXERCISE. Design an algorithm and the corresponding flowchart of the problem below.

1. Create a Java program that will let the user input the test value given below, then add the test
scores and then display:
26, 49, 98, 87, 62, 75

2. Create a Java program that will let the user input its name, number of hours worked and rate per
hour, compute the gross income by multiplying the hours worked and rate per hour, and then
display the name of the worker and its gross income.

3. Create a Java program that will let the user input its grade in Math, Science, English and Filipino,
calculate the average of four subjects and display the average.

4. Create a Java program that will let the user input the length and width of a rectangle, calculate is
area and perimeter and then display the area and perimeter of a rectangle.

5. Create a Java program that will let the user input the radius of the circle, calculate the area and
circumference of a circle and then display the area and circumference of a circle.

6. Create a Java program that will let the user input its name and age and then display if the user is
allowed to vote or not. NOTE: If the user input age is 17 below it shall display “YOU ARE NOT
ALLOWED TO VOTE”, but if the user age is 18 and above it shall display “YOU ARE ALLOWED TO
VOTE”.

7. Create a Java program that will calculate the perimeter of an equilateral triangle if one of the sides
is equal to 4, and then display its perimeter.

8. Create a Java program that will let the user input a number in Celsius and then display its
equivalent value in Fahrenheit.

9. Create a Java program that will let the user input a number in meter and then display its
equivalent value in centimeter.

10. Create a Java program that will let the user input its weight in kilogram and then display its
equivalent value in pounds.

PEDRO S. BONO JR., MIT


Instructor
DE LA SALLE JOHN BOSCO COLLEGE
Mangagoy, Bislig City
COLLEGE OF COMPUTER STUDIES

REFERENCE

1. Introduction to Computer and Programming (PDF)


2. Algorithms and Flowchart (PDF)

PEDRO S. BONO JR., MIT


Instructor

You might also like