File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 this . radius = radius ;
1515 }
1616
17- circumference ( ) {
18- return 6.4 * this . radius ;
19- }
20-
21- area ( ) {
22- return 3.2 * this . radius ** 2 ;
23- }
2417
25- static fromInput ( inputId , outputId ) {
18+ static circumference ( inputId , outputId ) {
2619 document . getElementById ( 'circle-radius' ) . addEventListener ( 'keydown' , function ( cr ) {
2720 if ( cr . key === 'Enter' ) {
2821 const radius = parseFloat ( this . value ) ;
2922 const circle = new Circle ( radius ) ;
30- const calculatedArea = document . getElementById ( outputId ) ;
31- output . innerText = `Area: ${ circle . area ( ) . toFixed ( 5 ) } units²` ;
32-
33- const calculatedCircumference = document . getElementById ( outputId ) ;
3423 output . innerText = `Circumference: ${ circle . circumference ( ) . toFixed ( 5 ) } units` ;
3524 }
3625 } ) ;
3726 }
3827
28+
29+ static area ( inputId , outputId ) {
30+ document . getElementById ( 'circle-radius' ) . addEventListener ( 'keydown' , function ( cr ) {
31+ if ( cr . key === 'Enter' ) {
32+ const radius = parseFloat ( this . value ) ;
33+ const circle = new Circle ( radius ) ;
34+ output . innerText = `Area: ${ circle . area ( ) . toFixed ( 5 ) } units²` ;
35+
36+ }
37+ } ) ;
38+ }
39+
3940 segment ( length , height ) {
4041
4142 document . getElementById ( 'chord-length' ) . addEventListener ( 'keydown' , function ( cl ) {
You can’t perform that action at this time.
0 commit comments