CMPE 011 Topic 1
CMPE 011 Topic 1
CMPE 011 Topic 1
• Mainframe computers
• Midsize computers
• Micro computers (personal computers)
• Hardware
• CPU
• Main memory
• Secondary storage
• Input/Output devices
• Software
• CPU
• Main memory: RAM
• Input/output devices
• Secondary storage
• CU (Control Unit):
− Fetches and decodes instructions
− Controls flow of information in and out of MM
− Controls operation of internal CPU
components
• PC (program counter): points to next
instruction to be executed
• EBCDIC
− Used by IBM
− 256 characters
• Unicode
− 65536 characters
− Two bytes are needed to store a character
LOAD rate
MULT hour
STOR wages
Sample Run:
My first C++ program.
The sum of 2 and 3 = 5
7 + 8 = 15
• Algorithm:
− Get length of the rectangle
− Get width of the rectangle
− Find the perimeter using the following
equation:
perimeter = 2 * (length + width)
− Find the area using the following equation:
area = length * width
• Get baseSalary
• Get noOfServiceYears
• Calculate bonus using the following formula:
if (noOfServiceYears is less than or equal to
five)
bonus = 10 * noOfServiceYears
otherwise
bonus = 20 * noOfServiceYears
• Get totalSales
• 10 students in a class
• Each student has taken five tests and each
test is worth 100 points
• Design an algorithm to calculate the grade for
each student as well as the class average
− Design an algorithm to find the average test score
− Design an algorithm to determine the grade
• Data consists of students’ names and their
test scores
• Structured design:
− Dividing a problem into smaller subproblems
• Structured programming:
− Implementing a structured design
• The structured design approach is also
called:
− Top-down (or bottom-up) design
− Stepwise refinement
− Modular programming
C++ Programming: From Problem Analysis to Program Design, Fourth Edition 51
Object-Oriented Programming
• Structured design:
− Problem is divided into smaller subproblems
− Each subproblem is solved
− Combine solutions to all subproblems
• Object-oriented design (OOD): a program is a
collection of interacting objects
− Object: data and operations on those data