Download presentation
Presentation is loading. Please wait.
Published byBranden Edwards Modified over 8 years ago
1
A High Flying Overview CS139 – Fall 2006 How far we have come
2
We started with the notion of an algorithm
3
Algorithm A step by step process for solving a problem in a finite amount of time given a finite amount of data.
4
Good algorithms Require thought – and reading all of the words And are: –Simple –Precise –Correct –Complete –Have levels of abstraction
5
Algorithm structures Sequencing Decisions Loops Abstraction (separate procedures)
6
We learned about our lab environment stu – Linux? Lab 250 Lab 248 Novell – n-drive m-drive??? mount-n submit
7
We made containers And learned that there were different kinds that held different data numbers letters Strings (why is this capital?) simple (value) complex (several values) Variable Constant literal
8
And performed operations on them addition assignment subtraction multiplication
9
And then we were ready to build our first program public class Hello { public static void main(String args[]) { System.out.println(“Hello World”); } But what does it mean???
11
But that was just the start Containers became variable, literals, and constants Operations became expressions Our programs began to really do something. Remember me? TripCalculator.javaTripCalculator.java
12
Of course that is when we also learned about documentation and the dreaded submit and of course we had to relearn division 3 / 6 is not.5 3 % 6 is not something to do with percentages. compile time errors run time errors logic errors
13
We got to know and love Scanner and output and printf (%s, %f, %d, %c)
14
Then we added decisions if(boolean expression) else { } JMmooDairyBar.java:56: 'else' without 'if' switch & case break; &&, ||, == and new error messages
15
And yes, the JMooDairy BarJMooDairy
16
Then came abstraction We learned that we can break code up and refer to a segment of code by a single name. Functions provided a way to reuse code; write once use any number of times. We also learned that we can create an application with multiple classes. Qualified names let us link all of these pieces together.
17
We also began to explore object oriented programming We began to use “classes” in a more purposeful way. We began to look at the “services” provided by java classes. –Scanner –System.out –Random –Math
18
variable = new ObjectName() Scanner (System.in) keyboard = constructor instantiation new
19
Passing 5 to the displayValue Method displayValue(5); public static void displayValue(int num) { System.out.println(“The value is “ + num); } The argument 5 is copied into the parameter variable num. The method will display The value is 5
20
And of course we had a PA to go along with functions Conversions.java
21
and we learned lots of new terms parameter argument visibility modifyer static qualified name return statement return type
22
On to the last of our “procedural” structures But of course not least…bring on the loops. infinite loop loop control variable off by one error 4 pre post for do/while while
23
And yet another PA
24
and Stars * *** ***** ******* ********* ******* ***** *** * ********** ******** ******* ****** ***** **** *** ** * ** *** **** ***** ****** ******* ******** ********* **********
25
Objects class – blueprint object – specific house
26
and more terms members attribute method visibility modifiers again this static instantiation constructor overloading mutator accessor immutable mutable
27
We learned to hand trace methods and objects Back to containers on a desk. Each container holds its current value. We must change the value as it changes during program execution Each container must be identified with its scope. And about scope….
28
block scope inside {} local - inside method { } global – inside class { } visibility is controlled by the scope of declaration
29
And even further “scope” static – belongs to the class non-static – belongs to individual objects of the class static = 1 container non-static = 1 container per object
30
And another pa
31
and finally arrays subscripted variable reference type arr1[3] elements are individual elements of array type. loops – for each loop index
32
and the last pa
33
Think about how far we have come And how much you have learned. What was hard is now easy. What is now hard will continue to be easy. Preview of 239
34
Next Semester Objects and objects Inheritance Input and output Exceptions Enumerated Types Polymorphism Abstract Classes Interfaces Recursion and much much more…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.