 |
Ryerson University
School of Computer Science |
CPS109 Computer Science 1
|
Class Notes Weeks 5 and 6

High Speed Internet!
Read Chapter 5 and 6 and read the announcements.
- Suggested Exercises from text
- Chapter 5 Decisions: P5.1, P5.2, P5.3 (I like this one), P5.4, P5.5 or
P5.6, P5.9, P5.14
- Chapter 6 Iteration: R6.4, R6.8, P6.1, as many of P6.3 to P6.10 as you
can do.
Pointless Media for CPS109
How about some review...
- In case you haven't figured it out yet, these are the basic steps in
creating Java programs (and pretty much any other computer programs):
The 14 Step Programming Process
0) State the problem
1) Understand the problem
2) Find/Develop an algorithm that addresses the problem
3) Understand the algorithm
4) Translate algorithm into Java
5) Enter/Edit program in text editor
6) Attempt to compile program using javac
7) Look at the compiler output
8) If there are no syntax errors skip the next step
9) Fix bugs and redo step 5
10) Run the program using java
11) Look at the program output
12) If the output is correct skip the next step
13) Fix semantic errors and redo step 5
14) Start testing for more semantic errors. |
"if" explained

"switch explained"

An example program illustrating selection and Iteration
- An example of how Selection works in java
- An example of how Iteration works in java
Some Typical loop examples
A typical example employing a while loop.
A typical example employing a do while
loop.
A typical example employing a for loop.

"Looper" the movie:
In
2074, when the mob wants to get rid of someone, the target is sent 30
years into the past, where a hired gun awaits. Someone like Joe, who
one day learns the mob wants to 'close the loop' by transporting back
Joe's future self. Watch the trailer.
"Looper" the code:
In
the early 21st century a class called "Looper" is created that makes
objects capable of creating 'hired gun' objects that fire "null"
bullets to kill other Looper objects. Watch how young Joe become wealth
in silver while dealing with the stiffs they send to him, finally he
deals with old Joe and, ultimately, himself. See the code plus lots and lots of examples of loops.
HEY! Test yourself.
WHAT DOES THIS JAVA PROGRAM OUTPUT (hand
execute it first and run it live afterwards)?
A bit of review before the test can be fouknd in MidReview. java and
MidReviewDriver.java (it is insufficient to pass the midterm but may help).
Other Interesting facts.
- You might say there is nothing constant in the field of computing except
change. Assuming you were even born in 1984 it was an interesting time.
People were discussing breaking up IBM because it had the patent on the PC
platform. With 640K on-board, it was a formidable machine. They were
talking about IBM's "predatory market practices". Meanwhile IBM was talking
about their ability to "Innovate".
- On Superbowl Sunday a small company that started in a garage pooled
together all of its resources and paid for a commercial slot during the
game. This is the commercial. it helped vault the
company to about a 20% market share in the Personal Computer market within
a year...It was played only once.
- It is slightly after the turn of the century Microsoft dominates the PC
operating system market. IBM releases this
commercial.
email:aferworn@scs.ryerson.ca