Skip to content

Commit 21d4ebb

Browse files
authored
Update Logic.html
1 parent d263bd5 commit 21d4ebb

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

Logic.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,29 @@
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) {

0 commit comments

Comments
 (0)