CS139 – Fall 2010 How far we have come

Slides:



Advertisements
Similar presentations
Written by: Dr. JJ Shepherd
Advertisements

George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Road Map Introduction to object oriented programming. Classes
COMP 14 Introduction to Programming Mr. Joshua Stough February 28, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
CS 201 Functions Debzani Deb.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
CS 225 Java Review. Java Applications A java application consists of one or more classes –Each class is in a separate file –Use the main class to start.
Review Java.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
CS0007: Introduction to Computer Programming Introduction to Arrays.
Classes, Objects, Arrays, Collections and Autoboxing Dr. Andrew Wallace PhD BEng(hons) EurIng
METHODS Introduction to Systems Programming - COMP 1005, 1405 Instructor : Behnam Hajian
Writing Classes (Chapter 4)
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter 5: Methods.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
1 Methods Introduction to Methods Passing Arguments to a Method More About Local Variables Returning a Value from a Method Problem Solving with Methods.
Working With Objects Tonga Institute of Higher Education.
Designing Classes CS239 – Jan 26, Key points from yesterday’s lab  Enumerated types are abstract data types that define a set of values.  They.
CONTROL STATEMENTS LOOPS. WHY IS REPETITION NEEDED?  There are many situations in which the same statements need to be executed several times.  Example:
By Mr. Muhammad Pervez Akhtar
Written by: Dr. JJ Shepherd
Chapter 5 Methods 1. Motivations Method : groups statements that perform a function.  Level of abstraction (black box)  Code Reuse – no need to reinvent.
Expressions Methods if else Statements Loops Potpourri.
A High Flying Overview CS139 – Fall 2006 How far we have come.
Method Examples CS 139 Algorithm Development 10/06/2008.
Functions in C++ Top Down Design with Functions. Top-down Design Big picture first broken down into smaller pieces.
A High Flying Overview CS139 – Fall 2010 How far we have come.
Information and Computer Sciences University of Hawaii, Manoa
Java Fundamentals 4.
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
CE221 – Data Structures & Algorithms Lab Introduction
Suppose we want to print out the word MISSISSIPPI in big letters.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Object Oriented Programming
Java Course Review.
Yanal Alahmad Java Workshop Yanal Alahmad
GC211Data Structure Lecture2 Sara Alhajjam.
Testing and Debugging.
Lecture 14 Writing Classes part 2 Richard Gesick.
Methods.
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Chapter Topics Chapter 5 discusses the following main topics:
Starting Out with Java: From Control Structures through Objects
Starting Out with Java: From Control Structures through Objects
Classes & Objects: Examples
Group Status Project Status.
IFS410 Advanced Analysis and Design
Defining methods and more arrays
More on Classes and Objects
Chapter 5: Methods Starting Out with Java: From Control Structures through Objects Third Edition by Tony Gaddis.
CS 200 Primitives and Expressions
Tonga Institute of Higher Education
Chapter 6 – Methods Topics are:
Starting Out with Java: From Control Structures through Objects
Lecture 5- Classes, Objects and Methods
CIS 199 Final Review.
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
In this class, we will cover:
Chapter 5: Methods Starting Out with Java: From Control Structures through Objects Third Edition by Tony Gaddis.
Chapter 5: Methods Starting Out with Java: From Control Structures through Objects Third Edition by Tony Gaddis.
OO Programming Concepts
2.1 Introduction to Object-Oriented Programming
Review for Midterm 3.
Corresponds with Chapter 5
Chapter 7 Objects and Classes
Announcements Lab 5 due Wednesday at noon.
Chapter 6: Methods CS1: Java Programming Colorado State University
Presentation transcript:

CS139 – Fall 2010 How far we have come A High Flying Overview CS139 – Fall 2010 How far we have come

We started with the notion of an algorithm A step by step process for solving a problem in a finite amount of time given a finite amount of data.

Good algorithms Require thought – and reading all of the words And are: Simple Precise Correct Complete Have levels of abstraction

Algorithm structures Sequencing Decisions Loops Abstraction (separate procedures) Abstraction (separate classes)

We learned about our lab environment mount-n Novell – n-drive submit Lab 248 Lab 250 stu – Linux?

We made containers And learned that there were different kinds that hold different data Constant numbers Strings (why is this capital?) variable letters simple (value) literal complex (several values)

And performed operations on them addition division subtraction assignment multiplication

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 that was just the start Containers became variables, literals, and constants Operations became expressions Our programs began to really do something. Remember me? PA1 (Change Maker)

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

We got to know and love Scanner // consume the new line More runtime errors And output System.out.print( “ blah “ + “blah”); and printf (%s, %f, %d, %c)

Then came abstraction We learned that we can break code up and refer to a segment of code by a single name. getAverage(5, 7, 9) 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.

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

And we played with Physics

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

variable = new ObjectName() constructor keyboard = Scanner (System.in) new instantiation

and we learned lots of new terms formal parameter return type argument visibility modifyer static return statement qualified name

Then we added decisions else if(boolean expression) &&, ||, == { } switch & case break; MadLibs.java:56: 'else' without 'if’ and new error messages

And of course, PA3

On to the last of our “procedural” structures But of course not least…bring on the loops. 4 while pre for do/while infinite loop loop control variable off by one error post

We saw Stars! * *** ***** ******* ********* ********** ********

And yet another PA

Then we learned to make objects class – blueprint object – specific house

and more terms members attribute method visibility modifiers again this static instantiation constructor overloading mutator accessor immutable mutable

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….

block scope inside {} local - inside method { } global – inside class { } visibility is controlled by where the declaration is made. Careful for (….);

And even further “scope” static – belongs to the class non-static – belongs to individual objects of the class static = 1 container named by the class non-static = 1 container per object

And what can we see between classes Private Public

And another PA

and finally arrays subscripted variable reference type arr1[3] One name, many items Collections loops – for each loop index

and the last pa

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 become easy.

Next semester in no particular order Objects, more and more Inheritance Input and output Exceptions Enumerated Types Abstract Classes Interfaces Polymorphism Recursion and much much more…

Tomorrow’s exam Will be much like a normal exam but the focus is on objects and arrays. Should be about the same length as other midterms Will include no big coding (but will likely include “small” coding).