/** * Homework Assignment #2 * Assigned on January 30, 2016 * Objective: Using Classes * Specs: http://www-rohan.sdsu.edu/~masc0555/cs108hw2.txt * * @author Tom Paulus * Created on 1/30/16. */publicclassCircle{doublex;// Circle's X positiondoubley;// Circle's Y positiondoubler;// Circle's Radius in unitspublicCircle(){// Default Constructorthis.x=0;this.y=0;this.r=1;}publicCircle(doublex,doubley,doubler){// Custom Constructorthis.x=x;this.y=y;this.r=r;}/** * Get the area of the Circle * * @return {@link double} Area of the circle in units. */publicdoublegetArea(){returncalcAreaForThisRadius(r);}/** * Get the area of a circle with the provided radius * * @param radius {@link double} Radius of the Circle * @return {@link double} Area of the Circle */publicstaticdoublecalcAreaForThisRadius(doubleradius){// Area = pi * r^2returnMath.PI*Math.pow(radius,2);}}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.