Created
May 14, 2018 03:37
-
-
Save djgoldsmith/5bfa8d31e002e8c2c51778a8c1ca0c99 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Circle { | |
var radius : Double | |
init(theradius: Double) { | |
//Update classes radius value with the one provided | |
radius = theradius | |
} | |
func getArea() -> Double { | |
//Calculate the area of the circle | |
return 3.14 * (radius * radius) | |
} | |
//Add a Function to Caluclate the Circumference (Pi * R * R) | |
func getCircumference() | |
{ | |
//Code Goes Here | |
} | |
//List of Circles | |
var theList = [2.0,4.0,6.0] | |
for item in theList { | |
//New Circle | |
var theCircle = Circle(theradius: item) | |
print ("Circle of Radius: \(item)") | |
print ("\tArea: \(theCircle.getArea())") | |
print ("\tCircum: \(theCircle.getCircumference())") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment