From 3f16cf40b3892d79409c16b57eba39efbf321973 Mon Sep 17 00:00:00 2001 From: chungcha Date: Fri, 15 Nov 2019 11:17:08 -0500 Subject: [PATCH] Done. --- index.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fd470fb..04f4bf3 100644 --- a/index.js +++ b/index.js @@ -1 +1,32 @@ -// Add your Circle class here \ No newline at end of file +class Circle { + + constructor(radius){ + this.radius = radius + } + + get diameter(){ + return this.radius * 2 + } + + get circumference(){ + return Math.PI * (this.diameter) + //this.diameter is a pseudoclass so don't need to invoke it + } + + get area(){ + return Math.PI*(this.radius**2) + } + + set diameter(newDia){ + this.radius = newDia/2 + } + + set circumference(newCirc){ + this.radius = (newCirc/Math.PI)/2 + } + + set area(newArea){ + this.radius = Math.sqrt(newArea/Math.PI) + } + +} \ No newline at end of file