Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Information Sheet No 1.1

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

3333333333333333333333333

Information Sheet No 1.1


INTRODUCTION TO PROGRAMMING

Learning Outcomes:

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


 Familiarize the basic programming terminology
 Describe data representation and manipulation
 Explain how algorithms and processing programs work
 Implement a simple program by writing the code, testing the code and debugging the program
Lyceum of Alabang Computer Programming 1

INTRODUCTION TO PROGRAMMING
Nowadays, computers have become irreplaceable. We use them to solve complex problems at the
workplace, have fun and communicate. Despite the fact that computers are so widespread, computers still rely
on human beings who will feed set of instructions to carry out a task. These instructions are called program, and the
person who write the program are called programmer.
How do computers understand the instruction given to it by the programmer? Because the computer is
powered by electricity, it can only understand an on or off switches as represented by 1 or 0. Programmers had to
write program instruction using a series of 1’s or 0’s called machine language or low-level language. As computer
technology evolves, the assembly language was developed which simplifies the very tedious task of writing a series
of 1’s or 0’s through alphabetic abbreviations called mnemonic code. Programs written in assembly language
require an assembler (other program) to convert the assembly code to machine code.

The rapid growth of computer hardware technology affects many programmers to develop another
programming language allowing them to use instruction that more closely resemble the English language called
high-level language. This language requires either an interpreter or a compiler to convert the English-like
instructions into machine language. There are many programming languages available in the market today. These
include C Sharp (contained on this manual), C, C++ COBOL, VB, VB.Net, etc. Compiler and interpreter is needed
to translate the instructions from high-level language to low-level language

Logic formulation and problem-solving skills are the fundamentals of programming. It requires intricate
process of critical and analytical thinking with precision and intensity to details. With this, planning is very
important because it serves as the backbone of any program.

ALGORITHM AND PSEUDOCODE

Algorithm is a finite set of instructions for carrying out some process step by step. This is the process
where the problem breaks down into simple steps so that the right answer may yield. A recipe in a cookbook is an
example of an algorithm. The complicated preparation of a dish is broken down into simple steps that even an
inexperience person in cooking can understand.

Pseudo code is an algorithm in English statements. It conveys the instructions before coding it using a
programming language such as C Sharp. The series of step-by-step instruction is outlined in an English word and
translate it to a language understandable by the computer.

STEPS IN SOLVING A PROBLEM

Historically, man has always tried looking for ways to simplify work and to solve problems more
efficiently. Such problems may involve numbers and quantities, which resulted to the better ways of counting using
mathematical operation. Regardless of the problem a man encounters, solving a problems involves the following;

1. Study the problem


2. Data gathering
3. Process the gathered data
4. Arrive at the solution

THE PROGRAMMING CYCLE

The computer is basically a problem-solving tool provided with a valid set of instructions by the
programmer becoming the computer a self-operational, that is, human intervention is not needed during the process
anymore. The five steps below should generally perform in sequence so as to attain an effective problem-solving
tool.

Information Sheet No 1.1 Page 2


Lyceum of Alabang Computer Programming 1

1. Define what has to be done or what problem has to be solved. The basic to planning a solution.

2. Planning a solution to the problem – Selecting the best method for solving a problem. It commonly
involves determining sequence of steps in solving a problem using pictorial representation.

3. Coding the solution – translating the series of steps into a code understandable by the computer to execute

4. Checking out the program by debugging and testing – Checking for any possible errors like logical and
syntax.

5. Documentation – Write up of the full specifications for other program users.

Example 1:

The radius of a circle is equal to three unit. Device an algorithm that will compute and display the area of the circle.

Algorithm steps:

1. Define the value of the radius (r).


2. Define the value of the pi = 3.1416
3. Calculate the area of the circle using the formula,
area = pi * r * r
4. Print the computed area

Example 2:

Compute the average quiz grade obtained by the students in his 3 quizzes. If the average is greater than or equal to
75, the remarks “passed” will be printed. Otherwise, if it is below 75, the remarks “failed” will display instead.

Algorithm steps:

1. Define the value of the 3 quizzes scored by the student


Let Q1 be the value of the first quiz
Q2 be the value of the second quiz
Q3 be the value of the third quiz

2. Compute the average grade (AVG) using the formula


AVG = (Q1 + Q2 + Q3) / 3
3. If the average grade is greater than or equal 75 then
print the word “Passed”
Else
Print the word “Failed”

Example 3:

Enter an age. If the age is less than 18, display the message “ you can not vote”. The program will only stop if the
age entered is 18 above.

Algorithm steps:

1. Define the value of the age


2. do
Enter the value of age

Information Sheet No 1.1 Page 3


Lyceum of Alabang Computer Programming 1

Print the message “you can vote”


loop
3. The program will end if age entered is 18 above.

References
Svetlin Nakov, Vaselin Kolev & Co. (2013) Fundamentals of Computer Programming with C Sharp

http://www.introprogramming.info

Information Sheet No 1.1 Page 4

You might also like