Professional Documents
Culture Documents
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.
DISCUSSION
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.
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.
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.
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
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.
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.
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.
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.
EXAMPLE OF FLOWCHARTING
Problem1: Create a program that will let the user input two numbers and display its sum.
Start
Enter num1
Enter num2
Display sum
End
Problem2: Create a java program that will let the user input its name and age.
Start
Enter name
Enter age
End
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.
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.
REFERENCE