Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Momentum With Time Calculator #1731

Merged
merged 17 commits into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Calculators/Momentum-With-Time-Calculator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# <p align="center">Momentum With Time Calculator</p>

## Description :-

The Momentum With Time Calculator is a web application designed to calculate the momentum of an object or a body with its given force and time, dynamically on the webpage.

## Tech Stacks :-

- HTML
- CSS
- JavaScript

## Features :-

- Calculate the momentum of a body based on the user input.
- Applicable to all types of units.
- User-friendly interface with modern styling and animations.

## How It Works :-

1. **Input Force**
- Enter the force of the body.

2. **Input Time**
- Enter the Time of the body.

3. **Calculate Momentum**
- Click the "Calculate" button to get the momentum.

4. **Result**
- The application will display the result of the calculation, i.e., the final momentum of the body.

## Screenshots :-

![Screenshot 2024-07-31 120129](https://github.com/user-attachments/assets/0f578db5-c877-487b-92c1-51a088ce3e02)
27 changes: 27 additions & 0 deletions Calculators/Momentum-With-Time-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!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>Momentum With Time Calculator</title>
</head>

<body>
<div class="calculator-container">
<h1>Momentum With Time Calculator</h1>
<label for="force">Enter Force </label>
<input type="number" id="force" placeholder="Enter force">
<br>
<label for="time">Enter Time </label>
<input type="number" id="time" placeholder="Enter change of time">

<button onclick="calculateM()">Calculate</button>

<div id="result" class="result-container"></div>
</div>
<script src="script.js"></script>
</body>

</html>
24 changes: 24 additions & 0 deletions Calculators/Momentum-With-Time-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function calculateM() {
// Get the input values
var force = parseFloat(document.getElementById("force").value);
var time = parseFloat(document.getElementById("time").value);

// Validate input
if (isNaN(force) || isNaN(time)) {
alert("Please enter valid numbers.");
return;
}

// Calculate momentum
var mom = (force * time);

// Display the result
var resultElement = document.getElementById("result");
resultElement.innerHTML = `
<div class="result-details">

<div>Momentum: ${mom.toFixed(2)}</div>

</div>
`;
}
85 changes: 85 additions & 0 deletions Calculators/Momentum-With-Time-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(to bottom right, #3fbaf3, #b91149);
margin: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}

.calculator-container {
background-color: #fff;
padding: 30px;
border-radius: 12px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
text-align: center;
animation: fadeInUp 0.8s ease-out;
}

button {
background-color: #4caf50;
color: #fff;
padding: 15px 30px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 18px;
margin-top: 20px;
transition: background-color 0.3s ease, transform 0.2s ease-out;
}

button:hover {
background-color: #45a049;
transform: scale(1.05);
}

input,
select {
padding: 15px;
margin: 15px 0;
width: 80%;
box-sizing: border-box;
font-size: 18px;
border: 1px solid #ccc;
border-radius: 6px;
transition: border-color 0.3s ease, transform 0.2s ease-out;
}

input:focus,
select:focus {
outline: none;
border-color: #4caf50;
transform: scale(1.02);
}

.result-container {
font-size: 20px;
font-weight: bold;
color: #333;
margin-top: 20px;
animation: fadeIn 1s ease-out;
}

/* Animations */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}

to {
opacity: 1;
transform: translateY(0);
}
}

@keyframes fadeIn {
from {
opacity: 0;
}

to {
opacity: 1;
}
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3039,6 +3039,20 @@ <h3>Calculates the momentum of the body using its mass and velocity.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Momentum With Time Calculator</h2>
<h3>Calculates the momentum of the body using its force and time.</h3>
<div class="card-footer">
<a href="./Calculators/Momentum-With-Time-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Momentum-With-Time-Calculator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Mortgage Refinance Calculator</h2>
Expand Down