CS442: ADVANCED PROGRAMMING USING JAVA Lab 6: Classes and objects Computer Science Department.

Slides:



Advertisements
Similar presentations
Topic 10 Java Memory Management. 1-2 Memory Allocation in Java When a program is being executed, separate areas of memory are allocated for each class.
Advertisements

Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 102 Computer Programming II (Lab:
Exception Handling Shirley Moore CS 1401 Spring 2013 cs1401spring2013.pbworks.com May 7,
Chapter 11: Classes and Objects
CS442: Advanced programming using java
Georgia Department of Education. Information Technology Pathways.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
TA: Nouf Al-Harbi NoufNaief.net :::
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Fall 2005CSE 115/503 Introduction to Computer Science I1 Association Also called “knows a”. A relationship of knowing (e.g. Dog-Collar as opposed to Dog-Tail)
UML Class Diagram: class Rectangle
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
Squares, Area, and Perimeter Test #7. Question 1 Area = 25cm 2 What is the perimeter?
UML Basics & Access Modifier
Chapter 6 Class Inheritance F Superclasses and Subclasses F Keywords: super F Overriding methods F The Object Class F Modifiers: protected, final and abstract.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
Dale Roberts Introduction to Java - Access Specifiers Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer.
© A+ Computer Science - Inheritance © A+ Computer Science - Lab 20.
computer
1 Given the Radio class  We may define other derivative types: Cassette walkman IS-A radio Alarm clock radio IS-A radio Car radio IS-A radio.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
© A+ Computer Science - public Triangle() { setSides(0,0,0); } Constructors are similar to methods. Constructors set the properties.
1 3/2/05CS250 Introduction to Computer Science II Composition and friend Functions.
UML (U NIFIED M ODELING LANGUAGE ) Prepared by Miss Simab Shahid Lecturer computer Science and Software Engineering department, University.
Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 102 Computer Programming II (Lab:
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
1 Introduction to Computer Science for Majors II CPSC 233, Winter 2013 CPSC 233, winter 2013 Tutorial 14, Mar 27/28, 2013.
Computer Science 209 Software Development Inheritance and Composition.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Cluster Analysis Data Mining Experiment Department of Computer Science Shenzhen Graduate School Harbin Institute of Technology.
Today’s Agenda 1.Collect Pre-Labs 2.Software engineering (CS 480) –Heavyweight approaches –Agile methods Extreme programming –Pair programming »PairDrawing.
1 Introduction to Computer Science for Majors II CPSC 233, Winter 2013 CPSC 233, winter 2013 Tutorial 14, Mar 27/28, 2013.
C++ Objects and Scope. Important Definitions  Class  Access and Visibility  Encapsulation  Unified Modeling Language (UML)  Constructor  Destructor.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Unified Modeling Language
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Object Oriented Programming using Java - Composition
Unit II-Chapter No. : 5- design Patterns
What to do in ICS4U? Grant Hutchison.
COMPUTER 2430 Object Oriented Programming and Data Structures I
Haidong Xue Summer 2011, at GSU
Objects as a programming concept
UML Class Diagram: class Rectangle
Haidong Xue Summer 2011, at GSU
CS 302 Week 10 Jim Williams.
Basic C++ What’s a declaration? What’s a definition?
CSC 113: Computer programming II
Inheritance, Polymorphism, and Interfaces. Oh My
Student Feedback on Robotics in CS1 The Fleet!
Ship Harbor Model Department of Computer Science University of Karachi
Cs212: DataStructures Computer Science Department Lab 3 : Recursion.
© A+ Computer Science - OOP © A+ Computer Science -
مديريت موثر جلسات Running a Meeting that Works
CS148 Introduction to Programming II
Instance Method – CSC142 Computer Science II
NAME 436.
C.2.10 Sample Questions.
C.2.8 Sample Questions.
C.2.8 Sample Questions.
Objects with ArrayLists as Attributes
Haidong Xue Summer 2011, at GSU
Find the Perimeter.
Presentation transcript:

CS442: ADVANCED PROGRAMMING USING JAVA Lab 6: Classes and objects Computer Science Department

Lab Contents  Creating Classes and objects.  Private members.  Defining constructors.  Set and get methods. 2

Case Study… 3 Write a program composed of two classes: 1. class Square. 2. class Use_Square, which contains method main that test the different methods in the class Square.

UML Diagram.. 4

Variables and constructors.. 5 Defined variables and constructors:

Set and get methods … 6 Defined set and get:

Area & perimeter methods … 7 Computing area and perimeter of square:

ToString.. 8 The method toString():

Main Class 9

Sample Run.. 10