From 5649c7df5fd70882a2cabf46978a095c4a31a119 Mon Sep 17 00:00:00 2001 From: Graham Flaspoehler Date: Sun, 17 Nov 2019 12:46:20 -0500 Subject: [PATCH] Done. --- index.js | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fd470fb..29b167c 100644 --- a/index.js +++ b/index.js @@ -1 +1,31 @@ -// Add your Circle class here \ No newline at end of file +const pi = Math.PI; + +class Circle { + constructor( radius ) { + this.radius = radius; + } + + get diameter() { + return this.radius * 2; + } + + set diameter( d ) { + this.radius = d / 2; + } + + get circumference() { + return 2 * pi * this.radius; + } + + set circumference( c ) { + this.radius = c / ( 2 * pi ) + } + + get area() { + return pi * Math.pow(this.radius, 2); + } + + set area( a ) { + this.radius = Math.sqrt( a / pi ) + } +} \ No newline at end of file