lab_CC_03 - CS1102S Data Structures and Algorithms...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1102S Data Structures and Algorithms Assignment CC01: Object-oriented Programming 1 Classification Define a class Circle that allows for creating a circle with a given radius: Circle myCircle = new Circle ( 7 . 5 ) ; Circle objects should support the following operations: retrieve the radius of the circle set the radius of the circle to a new value retrieve the circumference of the circle Solve this task using two different approaches: 1. Use a public field “radius” for the retrieval and setting of the radius, and use a static function to retrieve the circumference. 2. Use function “getRadius” for the retrieval and setting of the radius (where the radius is kept in a private field), and use a non-static function to retrieve the circumference. 2 Aggregation Define a class Person that allows for creating an person object with a given name, year of birth, and address: Person myPerson = new Person (”Tan Ka Boon” ,1975 , ”107 Pasir Ris Avenue 6; #03 - 01”); Person objects should support the following operations:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/09/2011 for the course CS 11025 taught by Professor Nil during the Spring '11 term at National University of Singapore.

Page1 / 2

lab_CC_03 - CS1102S Data Structures and Algorithms...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online