COMPSCI 172 – Introduction to Objected- Oriented programming in Java Class hour: 12:05-12:55 pm MWF (section 1). 1:10-2:00 pm MWF (section 2) McGraw Room.

Slides:



Advertisements
Similar presentations
Object Oriented Programming in Java George Mason University Fall 2011
Advertisements

Welcome to Introduction to Java Programming At J.D.O’Bryant Science & Mathematics Chonho Lee Department of Computer Science University of Massachusetts.
Lecture 1: An Introduction to Java. What is Java? Programming language developed by Sun Microsystems in 1995 –Inherits its syntax from c –Adapted the.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
Introduction to Java Programming, 4E
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3 Numerical Data.
OOP with Java, David J. Barnes Creating and Using Objects1 Why So Much for So Little? We want to use computers to solve complex tasks. Complex problems.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
1 Programming Languages Translation  Lecture Objectives:  Be able to list and explain five features of the Java programming language.  Be able to explain.
CSC 111 Course orientation
Programming Software Applications Week 1 Dr. Xiaohong Gao Trent Park – B107, ext. 2252
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
CS1101X: Programming Methodology Recitation 2 Classes.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Fundamental concepts in Java. Lesson plan Variable declaration, assign statement & practice Design document & practice.
Object Oriented Programming CEN 221. Course Description Classes, objects, inheritance, polymorphism, graphical user interfaces, event handling, exception.
Welcome to CS 3331, Advanced Object-Oriented Programming Fall 2009 Dept. of Computer Science University of Texas at El Paso.
COMPSCI 174- Introduction to C++ Class hour Section 01: MWF 9:55am – 10:45am. Hyer Hall 210.
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CS 106 Introduction to Computer Science I 01 / 25 / 2010 Instructor: Michael Eckmann.
Media Computing Instructor Byung Kim Olsen 231 Office hours – MWF 9:00-10:00 AM or by appointment.
CS 222: Immediate C++ Class Hour: Section: MWF 2:15PM - 3:05PM. McGraw 115.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
POS 406 Java Technology And Beginning Java Code
Introduction to Java Programming with Forte Y. Daniel Liang.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
Computer Science II 810:062 Section 01. How is CS I different from CS II? When you teach Java there are a series of decisions that have to be made…
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
CS1101X: Programming Methodology Recitation 1 Java Basics Numerical Data.
Introduction to Java Programming. Introduction Course Objectives Organization of the Book.
Introduction To JAVA By Ihtesham Ul Haq. Course Objectives Upon completing the course, you will understand Upon completing the course, you will understand.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
What Is Java? According to Sun in a white paper: Java: A simple, object-oriented, network-savvy, interpreted, robust, secure, architecture-neutral, portable,
Lecture 1 Introduction. Instructor Name: Seokwoo Song Office: business 524 Phone: Office Hours: M W 4:30 – 5:30 PM or by appointment
OOP with Java, David J. Barnes Bits, Bytes, and Java1 The Challenge Writing programs well is a challenge. –From coder to software engineer. We want programs.
 Programming Language  Object Oriented Programming  JAVA – An Introduction  JAVA Milestones  JAVA Features.
Lecture.1: Getting Started With Java Jiang (Jen) ZHENG May 9 th, 2005.
MCS 220: Concepts of Programming (focus on Object-Oriented Programming) Class Hour: Section 1: MWF 11:00AM - 11:50AM. Hyland 3202.
CSC204 – Programming I Lecture 1 August 23, 2006.
Computer Science 1 Lecture 1: administrative details and Professor: Evan Korth New York University 1.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
OOP with Java, David J. Barnes Creating and Using Objects1 Why So Much for So Little? We want to use computers to solve complex tasks. Complex problems.
CS1101: Programming Methodology
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
CSC1200 INTRODUCTION TO PROGRAMMING Dr. Maureen Markel
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
SOFTWARE DEVELOPMENT FOUNDATIONS, 1/12/12 J. Yates Monteith, Clemson University.
Learning Plan 6 Java Programming Intro to Object Oriented Programming.
Introduction to Java Programming, 4E Y. Daniel Liang.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CMSC 202 Computer Science II for Majors Fall 2010 Introduction Version 9/101.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
Chapter 1 Introduction to Computers, Programs, and Java
Chapter No. : 1 Introduction to Java.
Chapter 3 Numerical Data
Computer Programming 1 introduction to JAVA Lecture 1 Instructor: Ruba A. Salamah Islamic University of Gaza.
Accelerated Introduction to Computer Science
Introducing Java.
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

COMPSCI 172 – Introduction to Objected- Oriented programming in Java Class hour: 12:05-12:55 pm MWF (section 1). 1:10-2:00 pm MWF (section 2) McGraw Room 115

Course Objectives Given a description of a simple problem, formulate algorithms following object-oriented design concepts to solve this problem Given a description of a simple problem, implement the solution in Java which uses class construction, interface, methods, messages passing, file processing, and simple Graphical User Interface

Textbook/Technology requirement Textbook: An Introduction to Object-Oriented Programming with Java (third edition). C. Thomas Wu McGraw-Hill Publishing Software: J2SE Software Development Kit (SDK): Textpad: download at

Introduction Tell me about yourself and what you expect to get out from this course

Self-Introduction Recently graduated from the University of Connecticut (05 Class), Ph.D in Computer Science and Engineering Bachelor of Science from Hanoi University of Technology (86-91) Master of Computer Science from UW-Milwaukee (96-99)

Self-Introduction Research Experience: –User Modeling, Information Retrieval, Decision Theory, Collaborative Filtering, Human Factors Teaching Experience: –CS172, 181, 271 at UWW –Introduction courses at UOP and Devry –TA for Computer Architecture, OO Design, Compiler, Artificial Intelligence

Self-Introduction Teaching philosophy: –Interactive –Adaptive –Pro-active –Collaborative Other hobbies (non-academic related) –Movies –College Basketball –Family activities

Contact information Baker Hall 324 Office Hours: 2:15-4:15pm, MWF, or by appointment

Course detail - Topics Object-oriented design and implement using Java Understanding of algorithm, objects, classes Fundamentals of Java language & program Specific Applications

Course detail - Evaluation GRADABLEPOINTS Homework 1100 Homework 2100 Exam 1150 Exam 2150 Project 1100 Project 2100 Project 3100 Final Exam200 Total1000

What does it take to success Practice, practice, practice!!! (Programming, reading, doing practice exercises) Prior programming skills help Participate in class discussion and group discussion Thinking, thinking, thinking!!!

Questions?

Introduction to OO Programming and Java

Lesson plan History & Novelty of Java Class & Objects

History High-level programming language Low level programming language: CPU instruction sets. High level programming languages: Compiled (C/C++, Pascal) and interpreted language (Basic) Procedural (Pascal, C) and object oriented language (C++, Java)

Java’s Ancestry Oak: a reimplementation of C++ in the early 1990s by James Gosling. –Intended for intelligent consumer devices. Oak became Java in –Portability and Security of primary concern. –Eminently suitable for Web applets. –Also a powerful language in its own right.

What is news with Java? Platform-independent (portability) –The JVM is an imaginary CPU with bytecode instructions. Java programs are translated to bytecodes by the Java compiler Object-oriented: code reusable Lost of resources and tools

What is news with Java Inheritance: capability of a class to use the properties and methods of another class while adding its own functionality Polymorphism: capability of an action or method to do different things based on the object that it is acting upon

Practice (LoanCalculator) Type in TextPad and save the file as LoanCalculator.java Compile in TextPad by: –Tool -> Compile Java Run this application by –Tool -> Run Java Application (First save LoanCalculator.java file to C:\Document and Setting, under your directory, compile and run it)

/** * Sample program … **/ import javax.swing.*; /* Multiple comments */ import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Comments Multi-line comment Single-line comment

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { /* Add a multi-line comment here */ final int MONTHS_IN_YEAR = 12; // Add your comment here double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00");

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Import statement

/** * Sample program … **/ // import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00");

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Class Declaration

/** * Sample program … **/ import javax.swing.*; import java.text.*; Public class loancalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00");

/** * Sample program … **/ import javax.swing.*; import java.text.*; class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Class Declaration

Class and Objects A class definition provides a description of a typical object within that class. student, faculty, person An individual object is an instance of a class. Definition of behavior (methods) and attributes (fields).

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Behaviors (Main Method)

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ private final int MONTHS_IN_YEAR = 12; public static void main(String[] args) { double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Attributes (Fields)

Class and Objects (Example) Student_Steven Name=“Steven” Id=“001” Credit earned=50 Student_Emily Name=“Emily” Id=“002” Credit earned=100 Objects Student Name ID Credit earned Class

Class and Instances Class definition is like a blueprint or template. –Color, size, pattern might vary, but instances of the same class come from the same mold.

Object Interactions Communication between people: Information: “I am going to a party.” Question: “What is the time?” Order/Request: “Please buy me some gum.” Objects communicate in similar ways. Professor A getStudentEarnedCredits() StudentSteven 50

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df = new DecimalFormat("0.00"); Object Instantiation

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan ….. DecimalFormat df; // ….

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan String inputStr; ….. inputStr = JOptionPane.showInputDialog(null,"Loan Amount (dollars.cents):"); Object Interactions

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; double loanAmount; // represents the amount being borrowed int loanPeriod; // represents the number of years of the loan String inputStr; ….. inputStr = JOptionPane.showInputDialog(null,"Loan Amount (dollars.cents):"); Variable Declaration

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { final int MONTHS_IN_YEAR = 12; // double loanAmount; // represents the amount being.. int loanPeriod; // represents the number of years of the loan String inputStr; ….. inputStr = JOptionPane.showInputDialog(null,"Loan Amount (dollars.cents):");

/** * Sample program … **/ import javax.swing.*; import java.text.*; public class LoanCalculator{ public static void main(String[] args) { monthlyInterestRate = annualInterestRate / MONTHS_IN_YEAR/ 100; numberOfPayments = loanPeriod * MONTHS_IN_YEAR; monthlyPayment = (loanAmount * monthlyInterestRate)/(1- Math.pow(1/(1+monthlyInterestRate),numberOfPayments)); totalPayment = monthlyPayment * numberOfPayments; Assign Statement Expressions

Inheritance Student Graduate student Undergraduate student MastersDoctoral Law/ Medicine CommutingResident

Questions?