Lecture 1 Understanding Computer System 1
Lecture 1 Understanding Computer System 1
3
Software Types
4
Operations in Computer Program
Data items include all the text, numbers, and other raw material that
are entered into and processed by a computer.
5
Operations in Computer Program
6
Other Important Terms
o Program code - The instructions you write using a programming
language
o Syntax - rules governing a programming word usage and
punctuation.
o Syntax errors - Mistakes in a language’s usage.
o Random access memory, or RAM - is a form of internal, volatile
memory.
Programs that are currently running and data items that are
currently being used are stored in RAM for quick access.
7
Other Important Terms
o Compiler or interpreter - translate your source code into machine
language
o Machine language is also called binary language, and is represented
as a series of 0s and 1s.
8
Two Truths and a Lie
In each Two Truths and a Lie section, two of the numbered statements are
true, and one is false. Identify the false statement and explain why it is false.
9
Understanding
Simple Program Logic
Simple Program Logic
o For a program to work properly, you must develop correct logic;
11
Simple Program Logic
o Computer program to double any number you provide represented in
English-like statements:
input myNumber
set myAnswer = myNumber * 2
output myAnswer
12
Simple Program Logic
o The number-doubling process includes three instructions:
13
Two Truths and a Lie
In each Two Truths and a Lie section, two of the numbered statements
are true, and one is false. Identify the false statement and explain why it is false.
1. A program with syntax errors can execute but might produce incorrect
results.
14
Understanding the
Program
Development Cycle
Program development cycle
1. Understand the problem.
2. Plan the logic.
3. Code the program.
4. Use software (a compiler or interpreter) to translate the program into
machine language.
5. Test the program.
6. Put the program into production.
7. Maintain the program.
16
Program development cycle
17
Understanding the Problem
18
Planning the Logic
19
Coding the Program
⦿ After the logic is developed, only then can the programmer write the
source code for a program.
⦿ Coding refers to the part of programming that deals with writing
codes that a machine can understand.
20
QUESTION
22
Creating an Executable Program
23
Testing the Program
Example: Example:
24
Testing the Program
Example:
input myNumber
set myAnswer = myNumber + 2
output myAnswer
25
Putting the Program into Production
⦿ Putting the program into production might mean simply running the
program once, if it was written to satisfy a user’s request for a
special list.
⦿ Conversion, the entire set of actions an organization must take to
switch over to using a new program or set of programs.
26
Maintaining the Program
27
Declaring and Using
Variables and
Constants
Data Types
⦿ Numeric - one that can hold digits and have mathematical operations
performed on it.
⦿ String - can hold text, such as letters of the alphabet, and other special
characters, such as punctuation marks.
Languages such as C++, C#, Visual Basic, and Java distinguish between
integer (whole number) numeric variables and floating-point (fractional)
numeric variables that contain a decimal point.
30
Working with Variables
input myNumber
set myAnswer = myNumber * 2
output myAnswer
31
Working with Variables
32
Working with Variables
num mySalary
num yourSalary = 14.55
string myName
string yourName = "Juanita"
34
Variable Naming Conventions
35
Rules in Naming Variables
36
Assigning Values to Variables
⦿ Assignment statement - this statement incorporates two actions
that uses = symbol as an assignment operator.
Example:
set someNumber = 2
set someNumber = 3 + 7
set someOtherNumber = someNumber
set someOtherNumber = someNumber * 5
38
Assigning Values to Variables
⦿ lvalue - The result to the left of an assignment operator. The l is for
left.
Example: Not valid
set 2 + 4 = someNumber
set someOtherNumber * 10 = someNumber
set someNumber + someOtherNumber = 10
39
Assigning Values to Variables
⦿ Assignment Statements in Simpler Form
Example :
someNumber = 2
someOtherNumber = someNumber
40
Assigning Values to Variables
⦿ Assignment Statements
41
Declaring Named Constants
⦿ Named constant - similar to a variable, except it can be assigned a
value only once.
Example :
Example :
42
Two Truths and a Lie
In each Two Truths and a Lie section, two of the numbered statements
are true, and one is false. Identify the false statement and explain why it is false.
43