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 T-Score Calculator #1495

Merged
merged 7 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 13 additions & 0 deletions Calculators/T-Score-Calculator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# <p align="center">T-score Calculator</p>

## Description :-

A T-score calculator is a simple tool that allows individuals to calculate the T-score, which is used in hypothesis testing to determine if there is a significant difference between the sample mean and the population mean.

## Tech Stacks :-

- HTML
- CSS
- JavaScript

## Screenshots :-
31 changes: 31 additions & 0 deletions Calculators/T-Score-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>T-score Calculator</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="calculator">
<h1>T-score Calculator</h1>
<form id="tscoreForm">
<label for="sampleMean">Sample Mean (X̄):</label>
<input type="number" id="sampleMean" step="any" required />

<label for="populationMean">Population Mean (μ):</label>
<input type="number" id="populationMean" step="any" required />

<label for="sampleSD">Standard Deviation (s):</label>
<input type="number" id="sampleSD" step="any" required />

<label for="sampleSize">Sample Size (n):</label>
<input type="number" id="sampleSize" step="1" required />

<button type="button" onclick="calculateTScore()">Calculate</button>
</form>
<div id="result"></div>
</div>
<script src="script.js"></script>
</body>
</html>
23 changes: 23 additions & 0 deletions Calculators/T-Score-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function calculateTScore() {
const sampleMean = parseFloat(document.getElementById("sampleMean").value);
const populationMean = parseFloat(
document.getElementById("populationMean").value
);
const sampleSD = parseFloat(document.getElementById("sampleSD").value);
const sampleSize = parseInt(document.getElementById("sampleSize").value);

if (
isNaN(sampleMean) ||
isNaN(populationMean) ||
isNaN(sampleSD) ||
isNaN(sampleSize)
) {
document.getElementById("result").innerText = "Please enter valid numbers";
return;
}

const tScore =
(sampleMean - populationMean) / (sampleSD / Math.sqrt(sampleSize));

document.getElementById("result").innerText = `T-score: ${tScore.toFixed(2)}`;
}
79 changes: 79 additions & 0 deletions Calculators/T-Score-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
body {
background-image: url("https://media.istockphoto.com/id/1407983911/photo/forex-diagrams-and-stock-market-rising-lines-with-numbers.jpg?s=612x612&w=0&k=20&c=zas1h6LR6v2iCvE7SWnVoZ_s7ZSiboN45UK0d5oMWac=");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f4f4f4;
}

.calculator {
background: rgba(195, 241, 251, 0.6);
padding: 45px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}

h1 {
font-size: 24px;
color: rgb(250, 251, 255);
margin-bottom: 18px;
text-align: center;
font-size: 30px;
}

label {
text-align: center;
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #131616;
font-size: 20px;
}

form {
display: flex;
flex-direction: column;
align-items: center;
}

input {
text-align: center;
width: 100%;
padding: 8px;
margin-bottom: 25px;
border: 1px solid #4c8080;
border-radius: 7px;
font-size: 20px;
}

input:hover {
border: 3px solid #070a0a;
}

button {
width: 70%;
padding: 10px;
background: #4e9ff6;
color: #090808;
border: 2px solid #070a0a;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
}

button:hover {
background: linear-gradient(rgb(91, 91, 147), rgb(86, 86, 245));
}

#result {
margin-top: 30px;
font-size: 24px;
text-align: center;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3772,6 +3772,20 @@ <h3>Calculates the trisection points of a given two points(Line).</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>T-Score Calculator</h2>
<h3>Hypothesis testing to determine if there is a significant difference between the sample mean and the population mean.</h3>
<div class="card-footer">
<a href="./Calculators/T-Score-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/T-Score-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>Twin Prime Number Calculator</h2>
Expand Down