AP Computer Science: Class Model Final Review Fall 2015

AP Computer Science: Class Model Final Review Fall 2015
Using the class model, fill in the blanks and add the following.
Write a class MyCircle, stores information about a Circle. Your class should include:
a) Instance variables name, radius, and color .
b) Zero-argument
c) Three- argument constructor to initialize all instance variables with appropriate variables
d) toString() method to display the information ( include all instance variables)
e) getRadius() method to get the Radius
f) setRadius()method to set the Radius
g) and a getCircumference() method to calculate and return the value of
circumference of the circle C =
h) and a method isLarge
which will return true if the area is greater than 350 and false
if it is less than or equal to 350. Area of the circle: A =
,
On the back of the paper:
Write a separate “MyCircleDriver” class to:
a) Create an instance of a MyCircle device called “Circle1” using its zero-argument
constructor. Then display the information of “Circle1” using its toString()
method,
b) Create an instance of a MyCircle called a “Circle2” and set the name, radius,
color using the MyCircle's three-arguments constructor. Then display the
information of “Circle2” using its toString().
c) Then set the radius of “Circle1” to "15"
d) Use the method getCircumference() on object “Circle2” and display the
information
e) Use the method isLarge() on object “Circle1” and display the information.