SHS Ict 11 M1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Department of Education

Region V
Division of City Schools
Naga City
DON LEON Q. MERCADO HIGH SCHOOL

PROGRAMMING
JAVA
GRADE 11
Quarter 3 Week 1 Module 1

Learning Competency:
INTRODUCTION TO PROGRAMMING
LESSON 1

• Know about programming languages and their categories


• Understand the program development life cycle and apply it in
problem solving
DIVISION OF CITY SCHOOLS – NAGA CITY
DEPARTMENT OF EDUCATION
K TO 12 BASIC EDUCATION CURRICULUM JUNIOR HIGH SCHOOL TECHNICAL LIVELIHOOD
EDUCATION AND SENIOR HIGH SCHOOL - TECHNICAL-VOCATIONAL-LIVELIHOOD TRACK
INFORMATION AND COMMUNICATIONS TECHNOLOGY –PROGRAMMING JAVA NC II

INTRODUCTION TO
PROGRAMMING
SENIOR HIGH SCHOOL
GRADE 11

HOW TO USE THIS MODULE?

Before starting the module, I want you to set aside other tasks that will disturb you while
enjoying the lessons. Read the simple instructions below to successfully enjoy the
objectives of this kit. Have fun!
1. Follow carefully all the contents and instructions indicated in every page of this module
and follow the given instructions for each of the given learning outcome/s.
2. As you read, you can also do the hands-on to check if you were able to follow the
basic programming procedure.
3. Demonstrate what you have learned by doing what the Activity required you to do so.
4. Analyze conceptually the posttest and apply what you have learned.
5. Enjoy studying!

PARTS OF TH MODULE
Before starting the module, I want you to set aside other tasks that will disturb you while
enjoying the lessons. Read the simple instructions below to successfully enjoy the
objectives of this kit. Have fun!
1. Follow carefully all the contents and instructions indicated in every page of this module
and follow the given instructions for each of the given learning outcome/s.
2. As you read, you can also do the hands-on to check if you were able to follow the
basic programming procedure.
3. Demonstrate what you have learned by doing what the Activity required you to do so.
4. Analyze conceptually the posttest and apply what you have learned.
5. Enjoy studying!
• Expectations - These are what you will be able to know after completing the lessons in
the module.
• Pre-test - This will measure your prior knowledge and the concepts to be mastered
throughout the lesson.
• Technical terms - A word that has a specific meaning within a specific field of
expertise.
• Looking Back to your Lesson - This section will measure what learnings and skills did
you understand from the previous lesson.
• Brief Introduction- This section will give you an overview of the lesson.
• Activities - This is a set of activities you will perform with a partner.
• Remember - This section summarizes the concepts and applications of the lessons.
• Check your Understanding- It will verify how you learned from the lesson.
• Post-test - This will measure how much you have learned from the entire module.
INTRODUCTION TO PROGRAMMING

, LESSON 1
OVERVIEW OF COMPUTER PROGRAMMING

EXPECTATIONS:

At the end of the lesson, the student should be able to:

• Know about programming languages and their categories


• Understand the program development life cycle and apply it in problem solving

TECHNICAL TERMS:

, HARDWARE – Tangible part of computer it is composed of electronic and mechanical


Parts.
SOFTWARE - a series of instruction that tells the hardware what task to perform. It consist of data
And the computer program
Compiler - A programming statement may be translated into one or several machine
Instruction
Assembler – Assembly instruction is translated into one machine instruction by an
Assembler program.
Algorithm - is a clear and unambiguous specification of the steps needed to solve
a Problem
Pseudocode - which is a cross between human language and a programming
language.
PRE-TEST
Multiple Choice: Choose the letter of the correct answer .

1. To determine the outcome of your code, one must know?

A. What is the specific problem you want to solve or the task you want it to accomplish?
B. What facts will we learn from the process?
C. What formulas are applicable to the issue at hand?
D. What will be added or no longer exist?

2. Finding your starting and ending point are crucial to listing the steps of the process. To
determine a starting point, determine the answer to these questions, except?

A. What data/inputs are available?


B. Where is that data located?
C. What facts will we learn from the process?
D. What formulas are applicable to the issue at hand?
E.
3. As with the starting point, you can find the end point of your algorithm by focusing on
these questions, except?

A. What facts will we learn from the process?


B. What changes from the start to the end?
C. What will be added or no longer exist?
D. How do the data values relate to each other?

4. To use a real-world example, let’s say your goal is to have lasagna for dinner. You’ve
determined that the starting point is to find a recipe, and that the end result is that you’ll
have a lasagna fully cooked and ready to eat by 7 PM. What will you do?

A. Determine how will you accomplish each step.


B. List the steps from start to finish.
C. Find the ending point of the algorithm.
D. Determine the outcome of your code.

5. Now that you’ve written your algorithm, it’s time to evaluate the process by?
A. Review the algorithm.
B. List the steps from start to finish.
C. Find the ending point of the algorithm.
D. Determine how will you accomplish each step.

6. A standardized communication technique for expressing Instructions to a computer.

A. PSEUDOCODE
B. ALGORITHM
C. PROGRAMMING LANGUAGE
D. COMPILER
7. A programming statement may be translated into one or several machine instructions by
a ________.

A. Compiler
B. Assembler
C. Algorithm
D. Pseudocode

8. A programs that are needed to keep all the hardware and software systems running
together smoothly.

A. Application System
B. System Program
C. Program
D. Compiler

9. A high-level programming language is a programming language that is more user friendly


to some extent platform-independent, and abstract from low-level
computer processor operations such as memory accesses.

A. High -Level Programming


B. Low – Level Programming
C. Assembler
D. Compiler

10. A ____________ which is a cross between human language and a programming


language.

A. Algorithm
B. Program
C. Pseudocode
D. Compiler
BRIEF INTRODUCTION
Software
A software is the program that a computer uses in order to function. It is kept on
some hardware device like a hard disk, but it itself is intangible. The data that the
computer uses can be anything that a program needs. Programs acts like
instructions for the
processor.

Types of Computer Programs:

1. Systems Programs
• Programs that are needed to keep all the hardware and software systems running
together smoothly
• Examples:
• Operating Systems like Linux, Windows, Unix, Solaris, MacOS

2. Application Programs
• Programs that people use to get their work done
• Examples:
• Word Processor
• Game programs
• Spreadsheets

3. Compilers
• The computer understands only one language: machine language. Machine
language is in the form of ones and zeros. Since it is highly impractical for people
to create programs out of zeros and ones, there must be a way of translating or
converting a language which we understand into machine language, for this
purpose, there exists compilers.

Overview of Computer Programming


Languages
What is a Programming Language?

A programming language is a standardized communication technique for


expressing instructions to a computer. Like human languages, each language has
its own syntax
and grammar.

Programming languages enable a programmer to precisely specify what data a


computer will act upon, how these data will be stored/transmitted, and precisely
what actions to
take under various circumstances.

There are different types of programming languages that can be used to create
programs, but regardless of what language you use, these instructions are
translated into machine language that can be understood by computers.
Categories of Programming Languages

1. High-level Programming Languages

• A high-level programming language is a programming language that is more


userfriendly,
to some extent platform-independent, and abstract from low-level
computer processor operations such as memory accesses. A programming
statement may be translated into one or several machine instructions by a
compiler.
• Examples are Java, C, C++, Basic, Fortran

2. Low-level Assembly Language


• Assembly languages are similar to machine languages, but they are much easier
to
program in because they allow a programmer to substitute names for numbers.
Assembly languages are available for each CPU family, and each assembly
instruction is translated into one machine instruction by an assembler program.
Note: The terms "high-level" and "low-level" are inherently relative. Originally,
assembly
language was considered low-level and COBOL, C, etc. were considered high-level.
Many
programmers today might refer to these latter languages as low-level.

The Program Development Life Cycle

Programmers do not sit down and start writing code right away when trying to
make a computer program. Instead, they follow an organized plan or methodology,
that breaks the process into a series of tasks.

Here are the basic steps in trying to solve a problem on the computer:
1. Problem Definition
2. Problem Analysis
3. Algorithm design and representation (Pseudocode or flowchart)
4. Coding and debugging

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.

Let us now define our example problem:

“Create a program that will determine the number of times a name occurs in a list.”
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.

Example Problem:

Determine the number of times a name occurs in a list

Input to the program:


list of names, name to look for

Output of the program:


the number of times the name occurs in a list

Algorithm design and representation

Once our problem is clearly defined, we can now set to finding a solution. In
computer programming, it is normally required to express our solution in a step-by-
step manner.

An Algorithm is a clear and unambiguous specification of the steps needed to solve


a problem. It may be expressed in either Human language (English, Tagalog),
through a graphical representation like a flowchart or through a pseudocode, which
is a cross between human language and a programming language.

Now given the problem defined in the previous sections, how do we express our
general solution in such a way that it is simple yet understandable?

Expressing our solution through Human language:


1. Get the list of names
2. Get the name to look for, let's call this the keyname
3. Compare the keyname to each of the names in the list
4. If the keyname is the same with a name in the list, add 1 to the count
5. If all the names have been compared, output the result
Algorithm makes the whole procedure more efficient as well as consistent. It also helps in
identifying decision points, processes, and essential variables to solve the problem. A
programmer can also see and determine easily the errors in a particular process using an
algorithm.
STEPS IN WRITING AN ALGORITHM IN PROGRAMMING
1. Determine the outcome of your code.What is the specific problem you want to solve or
the task you want it to accomplish?
2. Decide on a starting point. Finding your starting and ending point are crucial to listing
the steps of the process. To determine a starting point, determine the answers to these
questions:
• What data/inputs are available?
• Where is that data located?
• What formulas are applicable to the issue at hand?
• What are the rules to working with the available data?
• How do the data values relate to each other?
3. Find the ending point of the algorithm. As with the starting point, you can find the
end point of your algorithm by focusing on these questions:
• What facts will we learn from the process?
• What changes from the start to the end?
• What will be added or no longer exist?
4. List the steps from start to finish. Start with broad steps. To use a real-world
example, let's say your goal is to have lasagna for dinner. You've determined that
the starting point is to find a recipe, and that the end result is that you'll have a
lasagna fully cooked and ready to eat by 7 PM.
5. Determine how you will accomplish each step. Now that you have a step-by-step
outline, it's time to think about how you might code each step.
6. Review the algorithm. Now that you've written your algorithm, it's time to evaluate the
process. Your algorithm is designed to accomplish something specific, and you'll need it
to start writing your program.

PROGRAMMING ALGORITHM

You probably wish you could see an example, right? So, what exactly does an algorithm in
programming look like? Well, asking a user for an email address is probably one of the most
common tasks a web-based program might need to do, so that is what we will use here for an
example. An algorithm can be written as a list of steps using text. We will make one of each
which you will see here:
Wasn't that easy? Notice how the top of our example is just a numbered list of steps using
plain English, stating exactly what we want the procedure to do (no more, no less). That's a
nice thing here, because in one of our steps (step 7) a decision must be made and,
depending on the result of that decision, our steps may not go in order from start to end.
Let's take a quick run through our little recipe:
1. Step 1 is really just a reminder that this is a procedure with a beginning and an end.

2. In step 2, we make a place in the computer to store what the user types in, also called a
variable
3. In step 3, we clear this variable because we might need to use it again and don't want the
old contents mixed in with the new.
4. In step 4, we prompt the user for an email address
5. In step 5, we stick it in our nifty variable.
6. In step 6, we tell our computer to take a close look at this email address-- is it really an
email address?

ALGORITHM EXAMPLES
EXAMPLE 1: Write an algorithm to convert the length in feet to centimeter
.
Step 1: Input Lft
Step 2: Lcm=Lft x 30
Step 3: Print Lcm

EXAMPLE 2: Write an algorithm that will read the two sides of a rectangle and calculate its
area.
Step 1: Input W,L
Step 2: A=LxW
Step 3: Print A
ACTIVITIES

1. Write an algorithm to print 1 to 20.

2. Write an algorithm to Convert temperature: Fahrenheit to Celsius. C=5/9*(F-32)

3. Write an algorithm that will calculate the roots of a quadratic equation ax2+bx+c=0. Hint:
d=sqrt(b2-4ac), and the roots are: x1=(-b+d)/2a and x2=(-b-d)/2a

4. Write an algorithm that reads two values, determine the largest value and prints the
largest value with an identifying message.
REMEMBERING

CHECK YOUR UNDERSTANDING

Direction: Write your understanding about the following:


How can an algorithm help in making an efficient program?
POST TEST

Multiple Choice: Choose the letter of the correct answer that referred to the statements
below on the steps in writing an algorithm.

1. To determine the outcome of your code, one must know?

A. What is the specific problem you want to solve or the task you want it to accomplish?
B. What facts will we learn from the process?
C. What formulas are applicable to the issue at hand?
D. What will be added or no longer exist?

2. Finding your starting and ending point are crucial to listing the steps of the process. To
determine a starting point, determine the answer to these questions, except?

A. What data/inputs are available?


B. Where is that data located?
C. What facts will we learn from the process?
D. What formulas are applicable to the issue at hand?
E.
3. As with the starting point, you can find the end point of your algorithm by focusing on
these questions, except?

A. What facts will we learn from the process?


B. What changes from the start to the end?
C. What will be added or no longer exist?
D. How do the data values relate to each other?

4. To use a real-world example, let’s say your goal is to have lasagna for dinner. You’ve
determined that the starting point is to find a recipe, and that the end result is that you’ll
have a lasagna fully cooked and ready to eat by 7 PM. What will you do?

A. Determine how will you accomplish each step.


B. List the steps from start to finish.
C. Find the ending point of the algorithm.
D. Determine the outcome of your code.

5. Now that you’ve written your algorithm, it’s time to evaluate the process by?
A. Review the algorithm.
B. List the steps from start to finish.
C. Find the ending point of the algorithm.
D. Determine how will you accomplish each step.

6. A standardized communication technique for expressing Instructions to a computer.

A. PSEUDOCODE
B. ALGORITHM
C. PROGRAMMING LANGUAGE
D. COMPILER
7. A programming statement may be translated into one or several machine instructions by
a ________.

A. Compiler
B. Assembler
C. Algorithm
D. Pseudocode

8. A programs that are needed to keep all the hardware and software systems running
together smoothly.

A. Application System
B. System Program
C. Program
D. Compiler

9. A high-level programming language is a programming language that is more user friendly


to some extent platform-independent, and abstract from low-level computer processor
operations such as memory accesses.

A. High -Level Programming


B. Low – Level Programming
C. Assembler
D. Compiler

10. A ____________ which is a cross between human language and a programming


language.

A. Algorithm
B. Program
C. Pseudocode
D. Compiler
LESSON 1 - Let’s do the checking

PRE-TEST AND POST TEST

1. B
2. A
3. C
4. B
5. B
6. A
7. C
8. B
9. A
10. C

ACTIVITIES
CHECK YOUR UNDERSTANDING

1. How can an algorithm help in making an efficient program?

Answer: An algorithm makes the whole procedure more efficient as well consistent. It helps in
identifying decision points, processes, and essential variables to solve the problem. A programmer
can also see the errors in a particular process using an algorithm.

REFERENCES:

Innovative Training Works, Inc. “Computer Programming Volume I” Technical Vocational


Livelihood K to 12 First Edition https://faradars.org/wp-content/uploads/2015/07/Algorithm-
and-Flow-Chart.pdf

https://sielearning.tafensw.edu.au/toolboxes/Database_Administration/software/content/pro
grammingconstructs/control_structures.htm

https://study.com/academy/lesson/what-is-an-algorithm-in-programming-definition-examples-
analysis.html

Java-student-Manual-Programming1

PREPARED BY:
HAZEL B. FRANCE
Teacher

You might also like