Chapter 1 : Overview of Computer and Programming
By Suraya Aliashttp://surayalias.wikispaces.com/
KK10103
Computer• A machine that can receive, store, transform, and output data
of all kinds Microproccesor / Central Processing Unit (CPU)
• A silicon chip containing the circuitry for a computer processor• Coordinates all computer operations and perform arithmetic
and logical expression on data Hardware
• The actual component equipment such as mouse, monitor, keyboard. Is tangible.
Software• Set of programs associated with a computer• Programs – list of instructions that enables computer to
perform specific task• Is Intangible or not tangible
1-2
1-3
1-4
Memory • Refers to data storage such as Random Access Memory
(RAM) and Read Only Memory (ROM) Memory cell
• an individual storage location in a memory Address memory
• the position of the memory cell in the main memory RAM
• Volatile memory (need power to access it), the part of the main memory that temporarily stores programs, data and results
ROM• Non-volatile memory, the part of memory that permanently
stores program and data such as system date and time in your pc or BIOS settings
1-5
1-6
1-7
1-8
•Bit – Binary digit of 0 and 1•Byte
the amount of storage required to store a single character1 byte = 8 bits1Kilobyte = 1024 byte1Megabyte = 1024 KB1Gigabye = 1024 MB
1-9
•Data storage•To retrieve data and to store data from the main memory
•Secondary Storage•Units such as hard disk, flash drive that retain data even the power is off
•Register• high speed memory location inside the CPU
1-10
Local Area Network (LAN)• Computer, printers, scanners devices connected by cables for
intercommunication
Metropolition Area Network (MAN)• is a large computer network that usually spans a city or a large
campus. A MAN usually interconnects a number of local area networks (LANs) using a high-capacity backbone technology, such as fiber-optical links, and provides up-link services to wide area networks and the Internet
Wide Area Network (WAN)• A network such as the Internet that connects computers and
LANs over the world***Discuss the differences between Internet, Intranet and Extranet.
1-11
1-12
1-13
System Software• Operating System (OS), such as Windows
Vista, MAC or Linux• Software that controls interaction between
user and the computer, and all the resources
Application software • Used for specific task such as Microsoft
Word, Adobe photoshop
1-14
Machine language • Binary number codes understood by a specific CPU (is not
standardized) Assembly Language
• Mnemonic codes that correspond to machine language notification
High Level Language• Machine-independent programming language that combines
algebraic expression and English symbols such as C and C++.• Such as x = x + y;• Means that add the value of variable x and y, and store the
results in variable x by replacing the previous value. Compiler
• Software that translates a high-level language program into machine language
1-15
Source File• File that contains program written in a high level language,
the input for a compiler• Created by the programmer using editor or word processor
such as ‘helloworld.c’• The C compiler will scan the source file, checks the programs
if it follows the syntax Syntax
• Grammar rules of a programming language• If ‘helloworld.c’ is correct, the compiler saves it in an object
file such as “helloworld.o” using binary file format Linker program
• Software that combines object files and resolves cross-reference to create an executable machine language program such as “helloworld.exe” that can be run using a loader
IDE (Integrated Development Environment)• High level compiler that are sold/distributed as a package
that combines an editor, compiler, linker and loader.• Such as Visual C++, codeblocks
1-16
1-17
1-18
Executing a program
Input -> Process -> Output
1) Specify the problem requirement 2) Analyze the problem 3) Design Algorithm to solve the
problem 4) Implement the Algorithm 5) Test and verify the completed
program 6) Maintain and update the program
1-19
Example 1) Problem Requirement
• State the problem clearly and what is required• Compute and display the total cost of apples given the
number of pounds of apples purchased and the cost per pounds of apples
2)Analysis• Identifies the input, output or any additional requirement
or constraint on the solution• Problem Input
Quantity of apples purchased (in pounds) Cost per pound of apples (in dollars per pound)
• Problem Output Total cost of apples (in dollars)
• Formula Total cost of apple = Cost per pound * pounds of apples
Abstraction The process of modeling a problem by extracting the
essential variables and their relationship Algorithm
• A list of steps for solving a problem Top-down Design (divide and conquer)
• Breaking a problem into its major sub problems and then solving the sub problems
3) Design• Designing the algorithm to solve the problem requires
you to develop a list of steps called an algorithm. • Use the top-down design method• Algorithm for programming problem
1) get the data 2) perform computation 3) display the results
• Stepwise refinement Development of a detailed list of steps to solve a
particular step in the original algorithm• Desk checking
The step by step simulation of the computer execution of an algorithm
4) Implementation• Implementing the algorithm involves writing it as program
using programming language such C or C++
5) Testing • Testing and verifying the program requires testing the
completed program to verify that it works as desired
6) Maintenance• Maintaining and updating the program involves modifying a
program to remove previous errors and change of requirement
1-22
Case study• Converting Miles to Kilometers
1) Problem Definition / Requirement• Write a program to convert distance from miles to kilometers
2) Analysis• What are the data requirement and formula needed?• Problem Input
miles /*distance in miles*/• Problem Output
kms /*distance in kilometers*/• Relevant formula
1 mile = 1.609 kilometers
1-23
3) Design• Algorithm
1) Get the distance in miles 2) Convert the distance to kilometers 3) Display the distance in kilometers
• Step 2 needs refinement 1) Get the distance in miles 2) Convert the distance to kilometers
2.1) The distance in kilometers is 1.609 times the distance in miles
3) Display the distance in kilometers
1-24
1-25