Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism 4.0 1.

Slides:



Advertisements
Similar presentations
Chapter 6 Objects and Classes F OO Programming Concepts F Creating Objects and Object Reference Variables –Differences between primitive data type and.
Advertisements

L3:CSC © Dr. Basheer M. Nasef Lecture #3 By Dr. Basheer M. Nasef.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java Program development.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Unified Modeling Language
Introduction To System Analysis and Design
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 2 Getting Started with Java Structure of.
Introduction to Java Programming, 4E
Chapter 8 User-Defined Classes and ADTs. Chapter Objectives Learn about classes Learn about private, protected, public, and static members of a class.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Software Engineering Principles and C++ Classes
ASP.NET Programming with C# and SQL Server First Edition
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
C++ fundamentals.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Introduction To System Analysis and design
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Syllabus (1) WeekChapters 1Introduction to the course, basic java language programming concepts: Primitive Data Types and Operations 1, 2 2Methods, Control.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
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.
Introduction To System Analysis and Design
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
The Java Programming Language
Introduction to Java Programming with Forte Y. Daniel Liang.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Objective You will be able to define and identify the basic components of a java program by taking notes, seeing examples, and completing a lab. Construction.
Data Structures Using C++1 Chapter 1 -Software Engineering Principles -ADT and Classes.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
Java The Java programming language was created by Sun Microsystems, Inc. It was introduced in 1995 and it's popularity has grown quickly since A programming.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
ECE 122 Feb. 1, Introduction to Eclipse Java Statements Declaration Assignment Method calls.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Classes, Interfaces and Packages
Chapter 6 - More About Problem Domain Classes1 Chapter 6 More About Problem Domain Classes.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
OOP Basics Classes & Methods (c) IDMS/SQL News
Data Structures Using Java1 Chapter 1 Software Engineering Principles and Java Classes.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-1 Learning Objectives  Classes  Constructors  Principles of OOP  Class type member.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
UFCFY5-30-1Multimedia Studio Coding for Interactive Media Fundamental Concepts.
Introduction to Java Programming, 4E Y. Daniel Liang.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Chapter 12 – Object-Oriented Design
Programming Logic and Design Seventh Edition
About the Presentations
Object-Oriented Programming
User-Defined Classes and ADTs
Chapter 8 Classes User-Defined Classes and ADTs
Copyright 2007 Oxford Consulting, Ltd
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
By Rajanikanth B OOP Concepts By Rajanikanth B
2.1 Introduction to Object-Oriented Programming
Presentation transcript:

Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism 4.0 1

2

Define modeling concepts: abstraction, encapsulation, and packages. 1 Analyze a problem using object-oriented analysis (OOA). 2 Create classes from objects using UML Class Diagram 3 Identify components of a class 4 Construct main method () using appropriate syntax 5 Apply escape sequence for special character 6 3

4 Abstraction Abstraction is the process of exposing only the relevant details and ignoring (hiding) the irrelevant details (Don't get confused with "datahiding" of the "Encapsulation"). Abstraction simplifies the understanding and using of any complex system.

5 Encapsulation Through encapsulation, you can control what parts of a program can access the members of a class. How a member of a class can be accessed is determined by the access modifier that modifies its declaration. Java’s access modifiers are: –public –private –protected

6 Packages Is a collection of classes that can be shared by Java programs. Are classified into  in-built packages – system packages  user-defined packages - Created by the users for their requirements.

7 The classes are grouped together based on their functionality. Some of the important packages of Java are:  lang  util  io  awt  net  applet

8 Analysis: Precise abstraction of what the desired system must do, not how it will be done. Object-Oriented Analysis is method which examines requirements from the perspective of the classes and objects. OOA Process: Use Case Modeling – shows functions Class-based Modeling – Class diagram, CRC Behavioral Model – State Diagram, Sequence Diagram

9 Example : Illustrate and explain object oriented and analysis by develop an information system to support all customer-related business in car rental company. The system should support management of customer data, reservations, vehicle rental and customer billing. 1)Identify problem domain : ………….. 2)Objects: …….. 3)Attributes: ……. 4)Operation: ……….

10 Draw a class diagram based on scenario below:- A customer makes order from retail catalog. Use Order as a central class. Associated with the order are the Customer making the purchase and the Payment. A Payment is one of three kinds; Cash, Cheque or Credit. The order contains OrderDetails, each with its associated Item.

11 Possible Objects, attributes and behavior :-

12 Example: Class : Bicycle Attributes/Behaviour  brand, colour, wheels, no of gear Method/Operations  speed, speed, stop, changeGear Notes: Public  + Private  - Class Attributes / behaviour Method / Operations

13 The class declaration Attribute variable declarations and initialization (optional) Methods (optional) Comments (optional) Structuring Classes

14 Syntax: [modifiers] class class_identifier Example: public class Shirt Class Declaration

15 public int shirtID = 0; public String description = “-description required-”; public char colorCode = ‘U’; public double price = 0.0; public int quantityInStock = 0; Variable Declaration and Assignment

16 A comment is text that is not part of your code but serves as guide when trying to figure out what the lines of code of your program are. To comment the contents of one line, you start it with double forward slashes like this // Example : //Here is where you put the comments You can include many lines of comments in your program. To do that, comment each line with the double slashes. An alternative is to start the beginning of the commented line or paragraph with /* and end the commented section with */ Example : /* Here is a simple sentence that I want to display when the program starts. It doesn't do much. I am planning to do more stuff in the future. */ Comments:

17 Syntax: [modifiers] return_type method_identifier ([arguments]){ method_code_block } Example: public void displayInformation() { System.out.println("Shirt ID: " + shirtID); System.out.println("Shirt description:" + description); System.out.println("Color Code: " + colorCode); System.out.println("Shirt price: " + price); System.out.println("Quantity in stock: " + quantityInStock); } // end of display method Methods

18 1 public class Shirt { 2 3 public int shirtID = 0; // Default ID for the shirt 4 public String description = "-description required-"; // default 5 // The color codes are R=Red, B=Blue, G=Green, U=Unset 6 public char colorCode = ’U’; 7 public double price = 0.0; // Default price for all shirts 8 public int quantityInStock = 0; // Default quantity for all shirts 9 10 // This method displays the values for an item 11 public void displayInformation() { 12 System.out.println("Shirt ID: " + shirtID); 13 System.out.println("Shirt description:" + description); 14 System.out.println("Color Code: " + colorCode); 15 System.out.println("Shirt price: " + price); 16 System.out.println("Quantity in stock: " + quantityInStock); } // end of display method 19 } // end of class) Class declaration Variable declaration and assignment Method displayInformation()

19 is a special method that the JVM recognizes as the starting point for every Java technology program that runs from a command line Syntax: public static void main (String [] args)

20 SequenceMeaning \bBackspace \tHorizontal tab \nLine feed \fForm feed \rCarriage return \”Double quote \’Single quote \\Back slash

// Program Welcome.java public class Welcome { public static void main (String args[]) { System.out.println(“Welcome\nto\nJava!"); } Welcome to Java! Welcome to Java! Output :-