Skip to content

Commit

Permalink
Files arranged and formatted with indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakesh9100 committed Mar 17, 2024
1 parent 80933d2 commit a36d4d6
Show file tree
Hide file tree
Showing 614 changed files with 10,540 additions and 10,610 deletions.
5 changes: 4 additions & 1 deletion Calculators/2D-Distance-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>2D Distance Calculator</title>
</head>

<body>
<div class="container">
<h1>2D Distance Calculator</h1>
Expand All @@ -25,4 +27,5 @@ <h1>2D Distance Calculator</h1>
<script src="script.js"></script>

</body>
</html>

</html>
36 changes: 17 additions & 19 deletions Calculators/2D-Distance-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
function calculateDistance() {
// Get input values
var x1 = parseFloat(document.getElementById('x1').value);
var y1 = parseFloat(document.getElementById('y1').value);
var x2 = parseFloat(document.getElementById('x2').value);
var y2 = parseFloat(document.getElementById('y2').value);

function calculateDistance() {
// Get input values
var x1 = parseFloat(document.getElementById('x1').value);
var y1 = parseFloat(document.getElementById('y1').value);
var x2 = parseFloat(document.getElementById('x2').value);
var y2 = parseFloat(document.getElementById('y2').value);

// Check if input values are valid
if (isNaN(x1) || isNaN(y1) || isNaN(x2) || isNaN(y2)) {
document.getElementById('result').innerHTML = 'Please enter valid numbers for both points.';
return;
}

// Calculate distance
var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));

// Display the result
document.getElementById('result').innerHTML = 'Distance: ' + distance.toFixed(2);
// Check if input values are valid
if (isNaN(x1) || isNaN(y1) || isNaN(x2) || isNaN(y2)) {
document.getElementById('result').innerHTML = 'Please enter valid numbers for both points.';
return;
}


// Calculate distance
var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));

// Display the result
document.getElementById('result').innerHTML = 'Distance: ' + distance.toFixed(2);
}
2 changes: 1 addition & 1 deletion Calculators/2D-Distance-Calculator/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ button:hover {
font-weight: bold;
color: #3498db;
font-size: 18px;
}
}
88 changes: 0 additions & 88 deletions Calculators/2D-Shapes-Calculator/2D-Shapes-Calculator.css

This file was deleted.

87 changes: 0 additions & 87 deletions Calculators/2D-Shapes-Calculator/2D-Shapes-Calculator.html

This file was deleted.

2 changes: 1 addition & 1 deletion Calculators/2D-Shapes-Calculator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Calculates the area and perimeter of 2D shapes.

## Screenshots :-

![Screen-Shot](image.png)
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/9ac08132-a71c-45c9-b4ba-a8bc70c6e502)
Binary file removed Calculators/2D-Shapes-Calculator/image.png
Binary file not shown.
90 changes: 90 additions & 0 deletions Calculators/2D-Shapes-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inconsolata:wght@500&display=swap" rel="stylesheet">
<title>2D Shapes Calculator</title>
</head>

<body>
<div class="card">
<div class="waviy">
<span style="--i:1">2</span>
<span style="--i:2">D</span>
<span style="--i:11">&nbsp;</span>
<span style="--i:3">S</span>
<span style="--i:4">H</span>
<span style="--i:5">A</span>
<span style="--i:6">P</span>
<span style="--i:7">E</span>
<span style="--i:8">S</span>
<span style="--i:9">&nbsp;</span>
<span style="--i:10">C</span>
<span style="--i:11">A</span>
<span style="--i:12">L</span>
<span style="--i:13">C</span>
<span style="--i:14">U</span>
<span style="--i:15">L</span>
<span style="--i:16">A</span>
<span style="--i:17">T</span>
<span style="--i:18">O</span>
<span style="--i:19">R</span>
</div>
<br><br>
<div class="row">
<select id="shape" name="shape" onchange="showDimensions()" required>
<option value="" disabled selected hidden>Select a shape</option>
<option value="rectangle">Rectangle</option>
<option value="square">Square</option>
<option value="circle">Circle</option>
<option value="triangle">Triangle</option>
<option value="parallelogram">Parallelogram</option>
<option value="rhombus">Rhombus</option>
<option value="trapezoid">Trapezoid</option>
<option value="hexagon">Hexagon</option>
<option value="nsides">N-Sided Polygon</option>
</select>
</div>
<br>
<div class="row" id="nsides-row" style="display: none;">
<label for="nofsides">No. of sides of polygon:</label>
<input type="number" id="nofsides" name="nofsides">
</div><br>
<div class="row" id="length-row" style="display: none;">
<label for="length">Enter Length:</label>
<input type="number" id="length" name="length">
</div><br>
<div class="row" id="width-row" style="display: none;">
<label for="width">Enter Width:</label>
<input type="number" id="width" name="width">
</div><br>
<div class="row" id="radius-row" style="display: none;">
<label for="radius">Enter Radius:</label>
<input type="number" id="radius" name="radius">
</div><br>
<div class="row" id="diagonal1-row" style="display: none;">
<label for="diagonal1">Enter Diagonal 1:</label>
<input type="number" id="diagonal1" name="diagonal1">
</div>
<br>
<div class="row" id="diagonal2-row" style="display: none;">
<label for="diagonal2">Enter Diagonal 2:</label>
<input type="number" id="diagonal2" name="diagonal2">
</div>
<div class="rule"></div>
<div class="form-footer">
<button class="button" onclick="calculate(event)">Calculate</button>
</div>
<div id="result-container">
<p id="result"></p>
</div>
</div>
<script src="script.js"></script>
</body>

</html>
Loading

0 comments on commit a36d4d6

Please sign in to comment.