Java

OOP GUIDE / WORK

 

CIRCLE CLASS

 

Topics

  • Instance variables
  • Constructors

 

 

TASK – PART 1 – CIRCLE CLASS


Create a Circle class.  The only data we need to store is the circle's radius.  We also want the constructor to accept a value for the radius.

 

TASK – PART 2 – TESTING THE CIRCLE CLASS


Create the class CircleTester.  Inside its main function, create a Circle with a radius of 6 and a Circle with a radius of 7. 

 

Then, create another Circle that has a radius that is the sum of the previous two circles.  You should make sure that the addition is done in Java as opposed to simply hardcoding the value 13.