SlideShare a Scribd company logo
Computer Programming Computer Programming
 Hardware: Electronic Devices
 Software: Instructions and Computer
Programs
 Input : Keyboard, Mouse
 System unit:
 Random Access Memory (RAM)
 Central Processing Unit (CPU)
 Output: Monitor, Printer
 Secondary Storage: Disk Drive
 Instructions for the hardware.
 Actions to be performed
 A set of instructions is called a program.
 Driving force behind the computer
 Without a program –What is a computer?
▪ Collection of Useless Hardware
 2 purposes:
 Tell the computer what to do
 Tell other people what we want the computer to
do.
 The central processing unit (CPU)
 The “brain” of a computer
 Retrieves instructions from memory and
executes them.
 Stores data and program instructions for CPU
to execute
 A program and its data must be brought to
memory before they can be executed
 Stores intermediate and final results of
processing.
 Volatile: Contents are erased when computer
is turned off or reset.
 A memory unit is an ordered sequence of
bytes, each holds eight bits.
 A byte is the minimum storage unit.
 No two data can share or split the same byte.
 Devices are Hard Drives, CDs/DVDs, Flash
Drives, etc.
 Non-Volatile or Permanent Storage
 Programs and data are permanently stored
on storage devices and are moved to memory
when the computer actually uses them.
 Core operational units of digital devices have
two stable states,
 which are referred to as zero and one by convention
 Combinations of different units with different
states are represented with the binary number
system
 0 and 1.
 A single digit (0 or 1) is called a bit, represents either
of binary states.
 Binary Language
 Data and instructions are encoded as binary
numbers - a series of bits
 one or more bytes made up of zeros and ones
 Encoding and decoding of data into binary is
performed automatically by the system
based on the encoding scheme
 Encoding schemes
 Numeric Data: Encoded as binary numbers
 Non-Numeric Data: Encoded as binary numbers
using representative code
▪ ASCII – 1 byte per character (character means symbol)
▪ Unicode – 2 bytes per character
 Base 10, ten digits (0-9)
 The position (place) values are integral powers of
10:
 100(ones), 101(tens), 102(hundreds), 103(thousands)…
 (372)10 = 3 × 102 + 7 × 101 + 2 × 100
= 3 × 100 + 7 × 10 + 2 × 1
= 300 + 70 + 2
 n decimal digits - 10n unique values
 Base 2, two digits (0-1)
 The position (place) values are integral powers of
2:
 20(1), 21(2), 22(4), 23(8), 24(16), 25(32), 26(64)…
 (101)2 = 1 × 22 + 0 × 21 + 1 × 20
= 1 × 4 + 0 × 2 + 1 × 1
= 4 + 0 + 1
= (5)10
 n binary digits - 2n unique values
Computer Programming Computer Programming
 Computers can not use human languages,
 Programming in the binary language of
computers is a very difficult, tedious process
 Therefore, most programs are written using a
programming language
 are converted to the binary language used by the
computer
 Three major categories of programming
languages:
 Machine Language
 Assembly Language
 High level Language
 Natural language of a particular computer
 Primitive instructions built into every
computer
 The instructions are in the form of binary
code
 Any other types of languages must be
translated down to this level
 English-likeAbbreviations used for
operations (Load R1, R8)
 Assembly languages were developed to make
programming easier
 The computer cannot understand assembly
language
 - a program called assembler is used to convert
assembly language programs into machine code
 English-like and easy to learn and program
 Common mathematical notation
 area = radius * radius * 3.1415;
 Java, C, C++, FORTRAN,VISUAL BASIC,
PASCAL
A program written in a high-level language is called a
source program (or source code). Since a computer cannot
understand a source program. Program called a compiler is
used to translate the source program into a machine
language program called an object program.The object
program is often then linked with other supporting library
code before the object can be executed on the machine.
19
Compiler
Source File Object File Linker Excutable File
 Programming – the creation of an ordered set of
instructions to solve a problem with a computer.
 Only about 100 instructions that the computer
understands - Different programs will just use
these instructions in different orders and
combinations.
 The most valuable part of learning to program is
learning how to think about arranging the
sequence of instructions to solve the problem or
carry out the task
 Sequential Processing
 A List of Instructions
 Conditional Execution
 if / else
 Repetition
 Looping / Repeating
 Stepwise Refinement /Top-Down Design
 BreakingThings into Smaller Pieces
 Calling Methods / Functions / Procedures / Subroutines
 Calling a segment of code located elsewhere
 Reuse of previously coded code segment
 Procedural
 Defining set of steps to transform inputs into outputs
 Translating steps into code
 Constructed as a set of procedures
 Each procedure is a set of instructions
 Object-Oriented
 Defining/utilizing objects to represent real-world entities that
work together to solve problem
 Basic O-O Programming Components
▪ Class
▪ Object/Instance
▪ Properties
▪ Methods
 The process of defining a problem, searching for
relevant information and resources about the
problem, and of discovering, designing, and
evaluating the solutions for further
opportunities. Includes:
 Finding an Answer to a Question
 Figuring out how to Perform aTask
 Figure out how to MakeThingsWork
 Not enough to know a particular programming
language… Must be able to problem solve…
 Read the Problem: Understand the
description of problem or scenario,
identifying the knowns and unkowns
 Decide how to go about solving the problem:
Determine what steps need to be taken to
reach the solution
 Solve the Problem: Write the solution
 Test the Answer: Make sure the answer is
correct
 In general, when we solve a computing
problem we are taking some inputs,
processing (performing some actions on) the
inputs, and then outputting the solution or
results.
 This is the classic view of computer
programming – computation as calculation
 Polya’s steps (UDIE) can be very effective
when applied to solving computing problems
Computer Programming Computer Programming
 What is the Problem to be solved?What is the
unknown?What is the condition?What is the
data?What is needed to solve the problem?
What actions need to take place?
 Identify the inputs and outputs
 Identify the processes needed to produce the
outputs from the given inputs
 Draw a figure. Introduce suitable notation.
 Isolate Principle parts of the problem.
 Find connections between the knowns and
unknowns.
 Simplify: Break the problem into smaller sub-
problems
 Design a solution
 Make a plan or list of actions to implement
the solution
 Algorithm / Flowchart / Psuedocode
 Algorithm
 A FINITE set of clear, executable steps that will eventually
terminate to produce the desired outcome
 Logical design used to solve problems – usually a list of
actions required to perform task
 Pseudocode
 Written like program code but more “English Like” and
doesn’t have to conform to language syntax
 Flowchart
 Diagram that visually represents the steps to be performed
to arrive at solution.
 Implement in a Programming Language
 Carry out the plan checking the preliminary
results at each step.
 Code A LittleTest A lot
 Run the Code
 Check results repeatedly and thoroughly
 Use numerous test cases or data sets
 Use highly varied test case, including expected as
well as and unexpected cases
 Look for new solutions
 Is there a better, easier, or more efficient solution
 Can other problems be solved using these
techniques?
35
 Tools are used to convert algorithms into
computer programs:
 Flowchart - Graphically depicts the logical steps to
carry out a task and shows how the steps relate to
each other.
 Pseudocode - Uses English-like phrases with some
programming terms to outline the program.
36
 How many stamps do you use when mailing a
letter?
 One rule of thumb is to use one stamp for
every five sheets of paper or fraction thereof.
37
1. Request the number of sheets of paper; call it
Sheets. (input)
2. Divide Sheets by 5. (processing)
3. Round the quotient up to the next highest
whole number; call it Stamps. (processing)
4. Reply with the number Stamps. (output)
38
 Graphically depict the logical steps to carry
out a task and show how the steps relate to
each other.
39
40
41
42
 Uses English-like phrases to outline the
task.
43
Determine the proper number of stamps for a
letter
Read Sheets (input)
Set the number of stamps to Sheets / 5 (processing)
Round the number of stamps up to the next
whole number (processing)
Display the number of stamps (output)
44
 Used in problem solving – take a large
problem and break it into smaller problems
solving the small ones first
 Breaks a problem down into modules
45
 Sequence – follow instructions from one line to
the next without skipping over any lines
 Decision - if the answer to a question is “Yes”
then one group of instructions is executed. If
the answer is “No,” then another is executed
 Looping – a series of instructions are executed
over and over
46
47
48
49
 Problem: Given a street number of a one-way
street in NewYork City, decide the direction
of the street, either eastbound or westbound
 Discussion: in NewYork City even numbered
streets are Eastbound, odd numbered streets
areWestbound
50
51
Program: Determine the direction of a numbered NYC
street
Get street
If street is evenThen
Display Eastbound
Else
Display Westbound
End If
52
 Problem: Calculate and report the grade-point
average for a class
 Discussion: The average grade equals the sum of all
grades divided by the number of students
Output: Average grade
Input: Student grades
Processing: Find the sum of the grades; count the
number of students; calculate average
53
54
Program: Determine the average grade of a class
Initialize Counter and Sum to 0
DoWhile there are more data
Get the next Grade
Add the Grade to the Sum
Increment the Counter
Loop
ComputerAverage = Sum / Counter
Display Average
 U - Read the Problem Statement
 Identify the inputs, outputs, and processes
 D - Decide how to Solve the Problem
 Create an Algorithm / Flowchart / Psuedocode
 I - Program the Code
 Implement in Programming Language
 E -Test the Solution
 Run the Code using numerous, varied test cases
Using Polya’s first 2 steps, understand and devise a solution to the
following problem:
 Determine the week’s earnings for an employee
from the hourly pay rate and hours worked for the
week. Report the gross earnings (including
overtime earnings) for the week.
 Definitions:
 Overtime hours = hours over 40
 Overtime pay rate = 1.5 * reg pay rate
Using Polya’s first 2 steps, understand and devise a solution to the
following problem:
Determine the week’s earnings for an employee from
the hourly pay rate, total hours for the week and
tax rate. Report the number of reg hours, overtime
hours, gross reg earnings, gross overtime earnings,
tax witheld, and total net earnings for the week.
Definitions:
 Overtime hours = hours over 40
 Overtime pay rate = 1.5 * reg pay rate
 Write an algorithm to serve as how-to
instructions for some relatively simple task or
activity. You choose the task, should be 10-20
steps in length. Assume you are writing
instructions for someone who has never
performed task before.

More Related Content

PPTX
Software
fiza1975
 
PPTX
Programming Fundamentals lecture 1
REHAN IJAZ
 
PPT
Computer Programming - Lecture 2
Dr. Md. Shohel Sayeed
 
PPT
OPERATING SYSTEM
Yanne Evangelista
 
PPTX
Introduction to computer
Hasnat Tariq
 
PPTX
System software vs application software
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Basic Computer Operation
Universidad De Zamboanga
 
PPTX
Introduction to Operating Systems
Damian T. Gordon
 
Software
fiza1975
 
Programming Fundamentals lecture 1
REHAN IJAZ
 
Computer Programming - Lecture 2
Dr. Md. Shohel Sayeed
 
OPERATING SYSTEM
Yanne Evangelista
 
Introduction to computer
Hasnat Tariq
 
System software vs application software
baabtra.com - No. 1 supplier of quality freshers
 
Basic Computer Operation
Universidad De Zamboanga
 
Introduction to Operating Systems
Damian T. Gordon
 

What's hot (20)

PDF
Computer programing 111 lecture 1
ITNet
 
PDF
Lab 1 Introduction to Computer
Halimaton Sa'adiah
 
PPTX
Software and hardware overview
ChristianEmard
 
PPT
Basic Computer Course
Mohamed Alasmar
 
PPT
Introduction to computer programming
NSU-Biliran Campus
 
PPTX
Basic Computer Training
Montgomery County Public Library
 
PPTX
Translators(Compiler, Assembler) and interpreter
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Computer Software and Operating System
Rupan Sharma
 
PPTX
Introduction to Computers
RIAH ENCARNACION
 
PPT
Computer basics
Karen Brooks
 
PPT
Chapter 1 - An Introduction to Programming
mshellman
 
PPTX
Algorithm Design & Implementation
Gaditek
 
PPT
Programming languages
Archana Maharjan
 
PPTX
operating system
KadianAman
 
PPT
Introduction to Information Technology Lecture Slides PPT
Osama Yousaf
 
PPTX
Computer Software And its types
Mirza Kaleem
 
PPT
Meaning Of VB
Mohit Verma
 
PPT
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci
 
PPS
Types Of Software
Laurize Albarracin
 
PPT
Programming Languages An Intro
Kimberly De Guzman
 
Computer programing 111 lecture 1
ITNet
 
Lab 1 Introduction to Computer
Halimaton Sa'adiah
 
Software and hardware overview
ChristianEmard
 
Basic Computer Course
Mohamed Alasmar
 
Introduction to computer programming
NSU-Biliran Campus
 
Basic Computer Training
Montgomery County Public Library
 
Translators(Compiler, Assembler) and interpreter
baabtra.com - No. 1 supplier of quality freshers
 
Computer Software and Operating System
Rupan Sharma
 
Introduction to Computers
RIAH ENCARNACION
 
Computer basics
Karen Brooks
 
Chapter 1 - An Introduction to Programming
mshellman
 
Algorithm Design & Implementation
Gaditek
 
Programming languages
Archana Maharjan
 
operating system
KadianAman
 
Introduction to Information Technology Lecture Slides PPT
Osama Yousaf
 
Computer Software And its types
Mirza Kaleem
 
Meaning Of VB
Mohit Verma
 
Unit 1 - Introduction to Software Engineering.ppt
DrTThendralCompSci
 
Types Of Software
Laurize Albarracin
 
Programming Languages An Intro
Kimberly De Guzman
 
Ad

Similar to Computer Programming Computer Programming (20)

PPT
computer programming introduction ppt.ppt
AlazarAlemayehu2
 
PPT
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
PPTX
Cs1123 2 comp_prog
TAlha MAlik
 
PPTX
Introduction.pptx
ssusera8c91a
 
PPT
01CHAP_1.PPT
ManoRanjani30
 
PPTX
Pj01 1-computer and programming fundamentals
SasidharaRaoMarrapu
 
PPT
programming language(C++) chapter-one contd.ppt
Fuadsabseb
 
PPTX
Csci101 lect00 introduction
Elsayed Hemayed
 
PPT
Comp102 lec 1
Fraz Bakhsh
 
PPT
lec_4_data_structures_and_algorithm_analysis.ppt
SourabhPal46
 
PPT
lec_4_data_structures_and_algorithm_analysis.ppt
Mard Geer
 
PDF
01 - Introduction to Computer and Algorithm (1).pdf
s241141868
 
PPTX
UNIT-1.pptx
archana gunakala
 
PPTX
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
 
PDF
L1. Basic Programming Concepts.pdf
MMRF2
 
PPTX
Module 1 python.pptx
AnuragJoshi813963
 
PPSX
CC-112-Lec.1.ppsx
Aamir Shahzad
 
PPTX
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
 
PPTX
Programming C ppt for learning foundations
ssuser65733f
 
PPTX
Introduction to computer programming
Sangheethaa Sukumaran
 
computer programming introduction ppt.ppt
AlazarAlemayehu2
 
Chapter 1- C++ programming languages +.ppt
anawaarabdujabbaar
 
Cs1123 2 comp_prog
TAlha MAlik
 
Introduction.pptx
ssusera8c91a
 
01CHAP_1.PPT
ManoRanjani30
 
Pj01 1-computer and programming fundamentals
SasidharaRaoMarrapu
 
programming language(C++) chapter-one contd.ppt
Fuadsabseb
 
Csci101 lect00 introduction
Elsayed Hemayed
 
Comp102 lec 1
Fraz Bakhsh
 
lec_4_data_structures_and_algorithm_analysis.ppt
SourabhPal46
 
lec_4_data_structures_and_algorithm_analysis.ppt
Mard Geer
 
01 - Introduction to Computer and Algorithm (1).pdf
s241141868
 
UNIT-1.pptx
archana gunakala
 
Algorithm Design and Problem Solving [Autosaved].pptx
KaavyaGaur1
 
L1. Basic Programming Concepts.pdf
MMRF2
 
Module 1 python.pptx
AnuragJoshi813963
 
CC-112-Lec.1.ppsx
Aamir Shahzad
 
vingautosaved-230525024624-6a6fb3b2.pptx
Orin18
 
Programming C ppt for learning foundations
ssuser65733f
 
Introduction to computer programming
Sangheethaa Sukumaran
 
Ad

Recently uploaded (20)

PDF
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PDF
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
PPTX
22PCOAM21 Session 2 Understanding Data Source.pptx
Guru Nanak Technical Institutions
 
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPT
Lecture in network security and mobile computing
AbdullahOmar704132
 
PPTX
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PDF
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
PPT
Ppt for engineering students application on field effect
lakshmi.ec
 
PPTX
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
PDF
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
PPTX
easa module 3 funtamental electronics.pptx
tryanothert7
 
settlement FOR FOUNDATION ENGINEERS.pdf
Endalkazene
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
Activated Carbon for Water and Wastewater Treatment_ Integration of Adsorptio...
EmilianoRodriguezTll
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
22PCOAM21 Session 2 Understanding Data Source.pptx
Guru Nanak Technical Institutions
 
July 2025: Top 10 Read Articles Advanced Information Technology
ijait
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Lecture in network security and mobile computing
AbdullahOmar704132
 
MSME 4.0 Template idea hackathon pdf to understand
alaudeenaarish
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
top-5-use-cases-for-splunk-security-analytics.pdf
yaghutialireza
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
Ppt for engineering students application on field effect
lakshmi.ec
 
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
EVS+PRESENTATIONS EVS+PRESENTATIONS like
saiyedaqib429
 
easa module 3 funtamental electronics.pptx
tryanothert7
 

Computer Programming Computer Programming

  • 2.  Hardware: Electronic Devices  Software: Instructions and Computer Programs
  • 3.  Input : Keyboard, Mouse  System unit:  Random Access Memory (RAM)  Central Processing Unit (CPU)  Output: Monitor, Printer  Secondary Storage: Disk Drive
  • 4.  Instructions for the hardware.  Actions to be performed  A set of instructions is called a program.  Driving force behind the computer  Without a program –What is a computer? ▪ Collection of Useless Hardware  2 purposes:  Tell the computer what to do  Tell other people what we want the computer to do.
  • 5.  The central processing unit (CPU)  The “brain” of a computer  Retrieves instructions from memory and executes them.
  • 6.  Stores data and program instructions for CPU to execute  A program and its data must be brought to memory before they can be executed  Stores intermediate and final results of processing.  Volatile: Contents are erased when computer is turned off or reset.
  • 7.  A memory unit is an ordered sequence of bytes, each holds eight bits.  A byte is the minimum storage unit.  No two data can share or split the same byte.  Devices are Hard Drives, CDs/DVDs, Flash Drives, etc.  Non-Volatile or Permanent Storage  Programs and data are permanently stored on storage devices and are moved to memory when the computer actually uses them.
  • 8.  Core operational units of digital devices have two stable states,  which are referred to as zero and one by convention  Combinations of different units with different states are represented with the binary number system  0 and 1.  A single digit (0 or 1) is called a bit, represents either of binary states.
  • 9.  Binary Language  Data and instructions are encoded as binary numbers - a series of bits  one or more bytes made up of zeros and ones
  • 10.  Encoding and decoding of data into binary is performed automatically by the system based on the encoding scheme  Encoding schemes  Numeric Data: Encoded as binary numbers  Non-Numeric Data: Encoded as binary numbers using representative code ▪ ASCII – 1 byte per character (character means symbol) ▪ Unicode – 2 bytes per character
  • 11.  Base 10, ten digits (0-9)  The position (place) values are integral powers of 10:  100(ones), 101(tens), 102(hundreds), 103(thousands)…  (372)10 = 3 × 102 + 7 × 101 + 2 × 100 = 3 × 100 + 7 × 10 + 2 × 1 = 300 + 70 + 2  n decimal digits - 10n unique values
  • 12.  Base 2, two digits (0-1)  The position (place) values are integral powers of 2:  20(1), 21(2), 22(4), 23(8), 24(16), 25(32), 26(64)…  (101)2 = 1 × 22 + 0 × 21 + 1 × 20 = 1 × 4 + 0 × 2 + 1 × 1 = 4 + 0 + 1 = (5)10  n binary digits - 2n unique values
  • 14.  Computers can not use human languages,  Programming in the binary language of computers is a very difficult, tedious process  Therefore, most programs are written using a programming language  are converted to the binary language used by the computer
  • 15.  Three major categories of programming languages:  Machine Language  Assembly Language  High level Language
  • 16.  Natural language of a particular computer  Primitive instructions built into every computer  The instructions are in the form of binary code  Any other types of languages must be translated down to this level
  • 17.  English-likeAbbreviations used for operations (Load R1, R8)  Assembly languages were developed to make programming easier  The computer cannot understand assembly language  - a program called assembler is used to convert assembly language programs into machine code
  • 18.  English-like and easy to learn and program  Common mathematical notation  area = radius * radius * 3.1415;  Java, C, C++, FORTRAN,VISUAL BASIC, PASCAL
  • 19. A program written in a high-level language is called a source program (or source code). Since a computer cannot understand a source program. Program called a compiler is used to translate the source program into a machine language program called an object program.The object program is often then linked with other supporting library code before the object can be executed on the machine. 19 Compiler Source File Object File Linker Excutable File
  • 20.  Programming – the creation of an ordered set of instructions to solve a problem with a computer.  Only about 100 instructions that the computer understands - Different programs will just use these instructions in different orders and combinations.  The most valuable part of learning to program is learning how to think about arranging the sequence of instructions to solve the problem or carry out the task
  • 21.  Sequential Processing  A List of Instructions  Conditional Execution  if / else  Repetition  Looping / Repeating  Stepwise Refinement /Top-Down Design  BreakingThings into Smaller Pieces  Calling Methods / Functions / Procedures / Subroutines  Calling a segment of code located elsewhere  Reuse of previously coded code segment
  • 22.  Procedural  Defining set of steps to transform inputs into outputs  Translating steps into code  Constructed as a set of procedures  Each procedure is a set of instructions  Object-Oriented  Defining/utilizing objects to represent real-world entities that work together to solve problem  Basic O-O Programming Components ▪ Class ▪ Object/Instance ▪ Properties ▪ Methods
  • 23.  The process of defining a problem, searching for relevant information and resources about the problem, and of discovering, designing, and evaluating the solutions for further opportunities. Includes:  Finding an Answer to a Question  Figuring out how to Perform aTask  Figure out how to MakeThingsWork  Not enough to know a particular programming language… Must be able to problem solve…
  • 24.  Read the Problem: Understand the description of problem or scenario, identifying the knowns and unkowns  Decide how to go about solving the problem: Determine what steps need to be taken to reach the solution  Solve the Problem: Write the solution  Test the Answer: Make sure the answer is correct
  • 25.  In general, when we solve a computing problem we are taking some inputs, processing (performing some actions on) the inputs, and then outputting the solution or results.  This is the classic view of computer programming – computation as calculation  Polya’s steps (UDIE) can be very effective when applied to solving computing problems
  • 27.  What is the Problem to be solved?What is the unknown?What is the condition?What is the data?What is needed to solve the problem? What actions need to take place?  Identify the inputs and outputs  Identify the processes needed to produce the outputs from the given inputs  Draw a figure. Introduce suitable notation.  Isolate Principle parts of the problem.
  • 28.  Find connections between the knowns and unknowns.  Simplify: Break the problem into smaller sub- problems  Design a solution  Make a plan or list of actions to implement the solution  Algorithm / Flowchart / Psuedocode
  • 29.  Algorithm  A FINITE set of clear, executable steps that will eventually terminate to produce the desired outcome  Logical design used to solve problems – usually a list of actions required to perform task  Pseudocode  Written like program code but more “English Like” and doesn’t have to conform to language syntax  Flowchart  Diagram that visually represents the steps to be performed to arrive at solution.
  • 30.  Implement in a Programming Language  Carry out the plan checking the preliminary results at each step.  Code A LittleTest A lot
  • 31.  Run the Code  Check results repeatedly and thoroughly  Use numerous test cases or data sets  Use highly varied test case, including expected as well as and unexpected cases  Look for new solutions  Is there a better, easier, or more efficient solution  Can other problems be solved using these techniques?
  • 32. 35  Tools are used to convert algorithms into computer programs:  Flowchart - Graphically depicts the logical steps to carry out a task and shows how the steps relate to each other.  Pseudocode - Uses English-like phrases with some programming terms to outline the program.
  • 33. 36  How many stamps do you use when mailing a letter?  One rule of thumb is to use one stamp for every five sheets of paper or fraction thereof.
  • 34. 37 1. Request the number of sheets of paper; call it Sheets. (input) 2. Divide Sheets by 5. (processing) 3. Round the quotient up to the next highest whole number; call it Stamps. (processing) 4. Reply with the number Stamps. (output)
  • 35. 38  Graphically depict the logical steps to carry out a task and show how the steps relate to each other.
  • 36. 39
  • 37. 40
  • 38. 41
  • 39. 42  Uses English-like phrases to outline the task.
  • 40. 43 Determine the proper number of stamps for a letter Read Sheets (input) Set the number of stamps to Sheets / 5 (processing) Round the number of stamps up to the next whole number (processing) Display the number of stamps (output)
  • 41. 44  Used in problem solving – take a large problem and break it into smaller problems solving the small ones first  Breaks a problem down into modules
  • 42. 45  Sequence – follow instructions from one line to the next without skipping over any lines  Decision - if the answer to a question is “Yes” then one group of instructions is executed. If the answer is “No,” then another is executed  Looping – a series of instructions are executed over and over
  • 43. 46
  • 44. 47
  • 45. 48
  • 46. 49  Problem: Given a street number of a one-way street in NewYork City, decide the direction of the street, either eastbound or westbound  Discussion: in NewYork City even numbered streets are Eastbound, odd numbered streets areWestbound
  • 47. 50
  • 48. 51 Program: Determine the direction of a numbered NYC street Get street If street is evenThen Display Eastbound Else Display Westbound End If
  • 49. 52  Problem: Calculate and report the grade-point average for a class  Discussion: The average grade equals the sum of all grades divided by the number of students Output: Average grade Input: Student grades Processing: Find the sum of the grades; count the number of students; calculate average
  • 50. 53
  • 51. 54 Program: Determine the average grade of a class Initialize Counter and Sum to 0 DoWhile there are more data Get the next Grade Add the Grade to the Sum Increment the Counter Loop ComputerAverage = Sum / Counter Display Average
  • 52.  U - Read the Problem Statement  Identify the inputs, outputs, and processes  D - Decide how to Solve the Problem  Create an Algorithm / Flowchart / Psuedocode  I - Program the Code  Implement in Programming Language  E -Test the Solution  Run the Code using numerous, varied test cases
  • 53. Using Polya’s first 2 steps, understand and devise a solution to the following problem:  Determine the week’s earnings for an employee from the hourly pay rate and hours worked for the week. Report the gross earnings (including overtime earnings) for the week.  Definitions:  Overtime hours = hours over 40  Overtime pay rate = 1.5 * reg pay rate
  • 54. Using Polya’s first 2 steps, understand and devise a solution to the following problem: Determine the week’s earnings for an employee from the hourly pay rate, total hours for the week and tax rate. Report the number of reg hours, overtime hours, gross reg earnings, gross overtime earnings, tax witheld, and total net earnings for the week. Definitions:  Overtime hours = hours over 40  Overtime pay rate = 1.5 * reg pay rate
  • 55.  Write an algorithm to serve as how-to instructions for some relatively simple task or activity. You choose the task, should be 10-20 steps in length. Assume you are writing instructions for someone who has never performed task before.