Certainly! Below is a simple HTML code for a pension calculator. Copy and paste it into an HTML file, and you can open it in a web browser to use the calculator. ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Pension Calculator</title> <style> label { display: block; margin-bottom: 8px; } </style> </head> <body> <h1>Pension Calculator</h1> <form id="pensionForm"> <label for="basicPay">Basic Pay:</label> <input type="number" id="basicPay" required> <label for="serviceYears">Total Service Years:</label> <input type="number" id="serviceYears" required> <label for="retirementAge">Retirement Age:</label> <input type="number" id="retirementAge" required> <button type="button" onclick="calculatePension()">Calculate Pension</button> <h2>Results:</h2> <p id="grossPensionResult">Gross Pension: </p> <p id="commuteResult">Commute: </p> </form> <script> function calculatePension() { const basicPay = parseFloat(document.getElementById('basicPay').value); const serviceYears = parseFloat(document.getElementById('serviceYears').value); const retirementAge = parseFloat(document.getElementById('retirementAge').value); const maxServiceYears = 30; const incrementFactor = (new Date().getMonth() >= 5) ? 2 : 1; const ageRate = getAgeRate(retirementAge); const grossPension = (basicPay * Math.min(serviceYears, maxServiceYears) * 70) / 3000; const commute = 0.35 * grossPension * 12 * ageRate; document.getElementById('grossPensionResult').innerText = `Gross Pension: ${grossPension.toFixed(2)}`; document.getElementById('commuteResult').innerText = `Commute: ${commute.toFixed(2)}`; } function getAgeRate(age) { // Age rates according to the Revised Pay Scale 2001 const ageRates = { 20: 40.5043, 21: 39.7341, 22: 38.9653, 23: 38.1974, 24: 37.4307, // ... (add the rest of the age rates) }; return ageRates[age] || 0; } </script> </body> </html> ``` Note: The age rates in the script are truncated for brevity. You should complete the list according to the provided data.
Write, Run & Share HTML code online using OneCompiler's HTML online Code editor for free. It's one of the robust, feature-rich online Code editor for HTML language, running on the latest version HTML5. Getting started with the OneCompiler's HTML compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as HTML
. You can also specify the stylesheet information in styles.css
tab and scripts information in scripts.js
tab and start coding.
HTML(Hyper Text Markup language) is the standard markup language for Web pages, was created by Berners-Lee in the year 1991. Almost every web page over internet might be using HTML.
<!DOCTYPE html>
<html>
and ends with </html>
<h1>
to <h6>
where <h1>
is the highest important heading and <h6>
is the least important sub-heading.<p>..</p>
tag.<a>
tag.
<a href="https://onecompiler.com/html">HTML online compiler</a>
<img>
tag, where src
attribute consists of image name.<button>..</button>
tag<ul>
for unordered/bullet list and <ol>
for ordered/number list, and the list items are defined in <li>
.<a href="https://onecompiler.com/html">HTML online compiler</a>
CSS(cascading style sheets) describes how HTML elements will look on the web page like color, font-style, font-size, background color etc.
Below is a sample style sheet which displays heading in green and in Candara font with padding space of 25px.
body{
padding: 25px;
}
.title {
color: #228B22;
font-family: Candara;
}
<table>
tag.<tr>
tag<th>
tag<td>
tag<caption>
tag<script>
is the tag used to write scripts in HTML<script src="script.js"></script>