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

Slides:



Advertisements
Similar presentations
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Starting Out with Java: From Control Structures through Objects Fourth.
Advertisements

Written by: Dr. JJ Shepherd
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.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Review Java.
Guide To UNIX Using Linux Third Edition
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
CS0007: Introduction to Computer Programming Introduction to Arrays.
Java Course Outline Kumar Harshit, USW. Course Description Teaches students to program using the Java programming language with the help of the Netbeans.
CS1101: Programming Methodology Aaron Tan.
Classes, Objects, Arrays, Collections and Autoboxing Dr. Andrew Wallace PhD BEng(hons) EurIng
METHODS Introduction to Systems Programming - COMP 1005, 1405 Instructor : Behnam Hajian
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
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.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Java ProgrammingtMyn1 Java Programming Timo Mynttinen Mikkeli University of Applied Sciences.
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.
Chapter 4: Control Structures II
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.
CSE 1301 Lecture 6 Writing Classes Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
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.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
By Mr. Muhammad Pervez Akhtar
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-1 Why Write Methods? Methods are commonly used to break a problem down.
Topic 8Classes, Objects and Methods 1 Topic 8 l Class and Method Definitions l Information Hiding and Encapsulation l Objects and Reference Classes, Objects,
Written by: Dr. JJ Shepherd
Chapter 5 : Methods. Why Write Methods?  Methods are commonly used to break a problem down into small manageable pieces. This is called divide and conquer.
Chapter 5 Methods 1. Motivations Method : groups statements that perform a function.  Level of abstraction (black box)  Code Reuse – no need to reinvent.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Expressions Methods if else Statements Loops Potpourri.
Method Examples CS 139 Algorithm Development 10/06/2008.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Functions in C++ Top Down Design with Functions. Top-down Design Big picture first broken down into smaller pieces.
CompSci 100E JB1.1 Java Basics (ala Goodrich & Tamassia)  Everything is in a class  A minimal program: public class Hello { public static void main(String[]
A High Flying Overview CS139 – Fall 2010 How far we have come.
9.1 CLASS (STATIC) VARIABLES AND METHODS Defining classes is only one aspect of object-oriented programming. The real power of object-oriented programming.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Information and Computer Sciences University of Hawaii, Manoa
CE221 – Data Structures & Algorithms Lab Introduction
Suppose we want to print out the word MISSISSIPPI in big letters.
Methods.
CS139 – Fall 2010 How far we have come
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
Group Status Project Status.
IFS410 Advanced Analysis and Design
Defining methods and more arrays
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
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.
Review for Midterm 3.
Corresponds with Chapter 5
Chapter 6: Methods CS1: Java Programming Colorado State University
Presentation transcript:

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

We started with the notion of an algorithm

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)

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

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

And performed operations on them addition assignment subtraction 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 what does it mean???

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

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 and output and printf (%s, %f, %d, %c)

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

And yes, the JMooDairy BarJMooDairy

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.

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() Scanner (System.in) keyboard = constructor instantiation new

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 of course we had a PA to go along with functions Conversions.java

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

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

And yet another PA

and Stars * *** ***** ******* ********* ******* ***** *** * ********** ******** ******* ****** ***** **** *** ** * ** *** **** ***** ****** ******* ******** ********* **********

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 the scope of declaration

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

And another pa

and finally arrays subscripted variable reference type arr1[3] elements are individual elements of array type. 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 be easy. Preview of 239

Next Semester Objects and objects Inheritance Input and output Exceptions Enumerated Types Polymorphism Abstract Classes Interfaces Recursion and much much more…