/** * Author: Josiah Yoder et al. * Class: SE1011-011 * Date: 12/6/13 11:35 AM * Lesson: Week 1, Day 3 * * Please note: This example does not compile */ package example1_3; /** * A Circle class * * Please note: This example does not compile * */ public class Circle extends Shape { private double radius; /** * Construct a new Circle. * * @param centerX the x (horizontal) component of the center position * measured in pixels * @param centerY the y (vertical) component * measured in pixels * @param radius the radius of the circle * measured in pixels * * Please note: This example does not compile because * the Circle class can't make a default shape * (there is no default Shape constructor) * * @author Josiah Yoder * @version 2013-12-6 */ public Circle(double centerX, double centerY, double radius) { // TODO: Fix compile bug here. // First attempt: // Does not work because centerX and centerY are private // this.centerX = centerX; // this.centerY = centerY; /* Potential Solutions: 1. Make them public 2. Make a getter/setter method in Shape Pros of solution 1: - Simple - Not really any others... Pros of solution 2: - Not that complicated - Keeps those variables private 1. So that other classes don't access them. 2. Even the circle class can mess things up. */ setCenter(centerX,centerY); this.radius = radius; } public String toString() { // TODO: Complete return ""; } }