Title: Before we start off
1Before we start off
2EE 222 Course 1
- Objectives
- Explain the sequence, selection and repetition
structures (know how and when to use them) - Write simple algorithms using the sequence,
selection and repetition structures - Explain the problem-solving process used to
create a computer program - Analyze a problem
- Write simple flow charts, desk-check an algorithm
3Our contract
- On my side
- I am working with future engineers and leaders so
I expect YOU to behave as such - provide a safe environment for you to
- share ideas (your own) and stand by then,
- to discuss those ideas
- exert your critical thinking without fearing to
be criticized - I want you to critique NOT to criticize
- There are no stupid questions !!!
- So ask questions, a lot of questions and
- Pay attention because there are quizzes during
the class oh yeah
4Our Contract (continued)
- On your sidevalues of the NAU and common sense
- diversity exert multicultural understanding
- integrity operate with fairness, honesty, and
higher ethical standards - civility engage with/ respect one another
- Work ethics attend classes, study, ask
questions, do your homework, program just to gain
more practice
5Lets talk about money
- According to the 2006-07 edition of the
Occupational Outlook Handbook (OOH) published
by the US dept of Labors bureau of stats - when hiring programmers, employers look for
people with - who can think logically and pay close attention
to details - ability to work on analytical work
- ingenuity and creativity are important for the
solution design - able to work with abstract concepts and to do
technical analysis - work in teams and interact directly with users,
and - able to communicate with non-technical personnel
6Well, well, well
- The bureau of labors stats predicts the
employment will grow as much as 8 between
2004-2014 - The OOH reports that average annual salaries in
2005 ranged from - 52,500 to 83,250 for application dvp
programmers/analysts - 55,000 to 88,250 for software developers
-
- Okayyyyy!
7Introduction
- Computers appear to be amazingly intelligent
machines, however - They cannot yet think on their own
- Computer rely on human beings to give them
directions - _______are the directions given to computers
- _______ are the people who write computer
programs - _______________ write, maintain, and/or customize
programs that handle a specific task - _______________ write and maintain programs that
help the computer carry out its _______________
functions
8Brief history of programming languages
- Human beings communicate with each other though
the use of languages such as tribal language,
Spanish, English or French. - Likewise programmers use a variety of languages
called _______________ to communicate with
computers. - E.g., C, C, Java, Visual Basic, Perl, C, COBOL
- Types
- Machine languages
- Assembly languages
- High-level languages
9From basic to more evolved
- Machine languages or _______________
- E.g 00100 10100 11100
- Av no other program needed to give instructions
to the computer no interpreter needed - Inc 1) each type of machine has ____________
- 2) Cumbersome to program
- Assembly languages
- E.g ADD
- Av no use of 0 or 1, the programmer uses
________ - ________ are alphabetic abbreviations for
instructions - Inc requires an ________(also a program) to
________ __________ into ________, the 0s and
1s that the computer understands - Programming in assembly language tedious and
requires highly training
10From more to highly evolvedHigh-level languages
- High-level languages
- e.g C, C etc
- Xxx Av instructions closely resemble the English
language - Ex grossPay hours rate
- High-level languages are more ________ than
machine or assembly languages. - In other words, the program can be used on very
different machines - Programs written in high-level language usually
require a ________ (also a program), to convert
English-like instructions into the 0s and 1s
that the computer can understand.
11High-Level Languages procedure vs. object
oriented pg
- When writing a ________ -oriented program, the
programmer concentrates on the ________ that the
program needs to perform - Examples COBOL, BASIC, C
- Real life Ex payroll program,
- Input employee data, calculate the gross pay,
calculate the tax, calculate the net pay and
output the pay check - In a _______________ program, the programmer must
determine - -The ________ instructions to give the computer
- -the _____________ of the instructions
12High-level languages procedure vs. object
oriented pg (cont.)
- An ________ -oriented program requires
programmers to focus on the ________ that the
program can use to accomplish its goal - Examples C, Visual Basic, Java, C
- Real life ex program written for the Windows
environment use objects such as check boxes, list
boxes, button etc. - An object is an ________ that can be used in
________ one program, usually with little or no
modification. - Ex employee object, check object
- A check object used in a payroll program can be
used in a sales revenue program (which receives
checks form customers).
13Why object-oriented programming is so popular?
- The ability to use an object for more than one
purpose save _____________ and ________ that is
why object-oriented programming is so popular.
14Control structures
- Programs are written using three basic structures
- ________
- Used in ________ program you write
- ________
- Used in ________ programs you write
- ________
- Used in most programs you write
- Called ________ structures or logic structures
15Sequence structure
- This is what you do when you follow directions,
in ________, from beginning to end,. - Real life ex cookie recipe
- To have edible cookie, you follow each recipe
instruction in order form the very first to the
very last. - Likewise, sequence structures in a computer
program ________ the computer to process the
program instructions, one after the other. - In ________ program, this selection will be
found.
16Course Lab 1 sequence concept
- Bob only knows walk, turn and sit
- He is 2 steps away from a chair
- Your job Get Bob ON the chair
17Course lab 1 - sequence concept
- An ________ a set of step-by-step ________ that
_________________. - Notice how important it is that Bob follows the
instructions in ________ if he really wants his
buttocks on the chair and not on the floor!
18Repetition structure
- Repetition structure directs computer to repeat
one or more instructions until some condition is
met - Also called a loop or iteration
- The repetition structure directs the computer to
- 1- ________ one or more instructions
- 2- ________ some ________ is met.
- Real life ex shampoo bottles, directions tell
you to repeat the apply shampoo to hair, lather
and rinse steps until your hair is clean.
19Course Lab 2 repetition struct.
- Now hes 50 steps away from the chair. He knows
walk, turn, sit and repeat x times. - Questions
- What does he need to repeat?
- What will be the condition to meet?
20Course Lab 2 repetition struct.
Notice the indentation under the repeat x
times. Give me examples of repetition structure
_______________________________ What is the
difference between both while structures?
- So now, If you DONT know how far away from the
chair Bob is, what condition needs to be met for
him to stop?
_________________________________
21Selection structure
- Other name ________ structure
- Make a decision and then takes an appropriate
action based on that decision. - Real life ex
- You stop with your car at a yield sign you can
either stop or proceed with caution through the
intersection. - In a computer program, the selection structure
alerts the computer that a decision needs to be
made and it provides the appropriate action to
take based on the result of that decision.
22Course Lab 3 selection struct.
- Bob is holding either a red or a yellow balloon
and is facing 2 boxes. One box is colored yellow
and the other red. Now Bob knows drop the balloon
and can recognize the color of the balloon. - He knows if and otherwise
- 2 cases to study
- 1-The boxes are located right in front of Bob
- 2-the boxes are located 20 steps away from Bob
Bob has to go to the boxes and come back to his
initial location
23Course Lab 3 selection struct.
24Mid-class summary
- Programs step-by-step instructions that tell a
computer how to perform a task - Programmers use programming languages to
communicate with the computer - First programming languages were machine
languages - High-level languages can be used to create
procedure-oriented programs or object-oriented
programs - Algorithm step-by-step instructions that
accomplish a task (not written in a programming
language) - Algorithms contain one or more of the following
control structures sequence, selection, and
repetition
25Mid-class summary (cont.)
- Sequence structure process the instructions, one
after another, in the order listed - Repetition structure repeat one or more
instructions until some condition is met - Selection structure directs the computer to make
a decision, and then to select an appropriate
action based on that decision