
"radius" refers to the method's argument
** Sets the radius to the given value */ "radius" refers to the method's parameter This.radius = radius // "this.radius" refers to the instance variable ** Constructs a Circle instance with the given radius and default color */ Keyword " this": Instead of using variable names such as r (for radius) and c (for color) in the methods' arguments, it is better to use variable names radius (for radius) and color (for color) and use the special keyword " this" to resolve the conflict between instance variables and methods' arguments.("color is: " + c4.getColor()) // Print color via getter // You cannot do the following because setRadius() returns void, which cannot be printed ("radius is: " + c4.getRadius()) // Print radius via getter Modify the TestCircle to test these methods, e.g.,Ĭircle c4 = new Circle() // construct an instance of Circle * The Circle class models a circle with a radius and color. The source codes for Circle.java is as follows: /**
Two public methods: getRadius() and getArea(), which return the radius and area of this instance, respectively. Two overloaded constructors - a default constructor with no argument, and a constructor which takes a double argument for radius. Two private instance variables: radius (of the type double) and color (of the type String), with default value of 1.0 and " red", respectively. This first exercise shall lead you through all the basic concepts in OOP.Ī class called circle is designed as shown in the following class diagram. Ownership of the Advanced Squad Leader Game System is required for play.ĪSL Journal 11 lists the balancing updates incorporated in these scenarios.ĪSL Journal 12 lists some errata to that list (the updated scenarios are OK).Exercises on Classes An Introduction to Classes and Instances by Example - The Circle Class (New errata have been issued for the old scenarios to reflect the balancing changes made in these updates.) Also included are eight mapboards: 16-19, 24, 40-41, and 46, which will help you play many of the 40 scenarios inside YANKS: the 16 original scenarios from YANKS and PARATROOPER (all re-balanced) as well as 24 more out-of-print scenarios, re-numbered and re-balanced, all with existing errata incorporated. Chapter H contains over 20 pages of detailed notes on the guns and vehicles, complete with some minor updates to the original. YANKS contains the entire United States Army order of battle for ASL, including five different squad types, their half squads, leaders, and all the varied vehicle, ordnance, and support weapon and crew counters, thus enabling you to command every type of combat unit used by the American Army in every theater throughout the war. YANKS is back, and better than ever, as it now includes the essential elements of PARATROOPER and 24 additional scenarios. This printing is the same as the 2016 printing.