defining classes to take now familiar examplea circle object will have instance variables such as centerwhich remembers the center point of the circleand radiuswhich stores the length of the circle' radius the methods of the circle will need this data to perform actions the draw method examines the center and radius to decide which pixels in window should be colored the move method will change the value of center to reflect the new position of the circle recall that every object is said to be an instance of some class the class of the object determines what attributes the object will have basically class is description of what its instances will know and do new objects are created from class by invoking constructor you can think of the class itself as sort of factory for stamping out new instances consider making new circle objectmycircle circle(point( , ) circlethe name of the classis used to invoke the constructor this statement creates new circle instance and stores reference to it in the variable mycircle the parameters to the constructor are used to initialize some of the instance variables (namely center and radiusinside of mycircle once the instance has been createdit is manipulated by calling on its methodsmycircle draw(winmycircle move(dxdy example programcannonball before launching into detailed discussion of how to write your own classeslet' take short detour to see how useful new classes can be program specification suppose we want to write program that simulates the flight of cannonball (or any other projectile such as bulletbaseballor shot putwe are particularly interested in finding out how far the cannonball will travel when fired at various launch angles and initial velocities the input to the program will be the launch angle (in degrees)the initial velocity (in meters per second)and the initial height (in metersof the cannonball the output will be the distance that the projectile travels before striking the ground (in metersif we ignore the effects of wind resistance and assume that the cannonball stays close to earth' surface ( we're not trying to put it into orbit)this is relatively simple classical physics problem the acceleration of gravity near the earth' surface is about meters per secondper second that means if an object is thrown upward at speed of meters per secondafter one second has passedits upward speed will have slowed to meters per second after another secondthe speed will be only meters per secondand shortly thereafter it will start coming back down