A simple yearly interest calculator is written in JavaScript to solve the loan of the customer.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg



=================================================

Want to support my channel?



GCash Account



Jake Pomperada

09173084360



Paypal

https://paypal.me/jakerpomperada



Patreon

https://www.patreon.com/jakerpomperada

 

Thank you very much for your support

 


Program Listing

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SIMPLE YEARLY INTEREST CALCULATOR</title>
    <style>
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #7A819F;
            color: #2B2E3E;
            font-family: sans-serif;
        }
        main {
            padding: 50px;
            border-radius: 10px;
            background-color: #D9D4D0;
            min-width: 500px;
        }
        h1 {
            margin-bottom: 5px;
            font-size: 28px;
            text-align: center;
        }
        h2 {
            margin-bottom: 30px;
            font-size: 20px;
            text-align: center;
        }
        .block {
            margin: 0 auto 12px;
            display: flex;
            align-items: center;

        }
        label {
            display: block;
            width: 35%;
            line-height: 40px;
            background-color: #47356E;
            color: #eee;
            text-align: center;
        }
        input {
            padding: 10px;
            width: 65%;
            font-size: 14px;
            border-radius: 0 5px 5px 0;
            border: 2px solid #000;
            outline: none;
        }
        .btnBlock {
            display: flex;
            width: 100%;
        }
        .btn {
            display: inline-block;
            padding: 15px;
            background-color: #CD8F3C;
            color: #fff;
            outline: none; 
            border: none;
            cursor: pointer;
            width: 150px;
            width: 50%;
            font-size: 16px;
            text-decoration: none;
            text-align: center;
            transition: all .2s;
        }
        .btnReset {
            background-color: #6B838E;
        }
        .btn:hover {
            opacity: 0.9;
        }
        .total {
            display: block;
            width: 100%;
            margin-top: 12px;
            padding: 20px 0;
            background-color: #2F4C58;
            font-size: 16px;
            text-align:center;
            color: #f3f3f3;
            line-height: 1.5;
        }
        .hide {
            display: none;
        }
    </style>
</head>
<body>
    <main class="container">
        <h1>SIMPLE YEARLY INTEREST<br>CALCULATOR</h1>
        <h2>Jake R. Pomperada, MAED-IT, MIT</h2>
        <form action="" id="frmCalc">
            <div class="block">
                <label for="grade1">Principal Amount:</label>
                <input type="number" min="1" id="principal" autofocus required>
            </div>
            <div class="block">
                <label for="grade2">Interest Rate (%):</label>
                <input type="number" min="0" max="100" id="rate" required>
            </div>
            <div class="block">
                <label for="grade3">Time in years:</label>
                <input type="number" id="time" required>
            </div>
            <div class="btnBlock">
                <button type="submit" class="btn">CALCULATE</button>
                <a href="" class="btn btnReset">RESET</a>
            </div>
            <div class="total hide"></div>
        </form>
    </main>

    <script>
        document.querySelector('#frmCalc').onsubmit  = (e) => {
            e.preventDefault()
            let total = document.querySelector('.total'),
                interest = document.querySelector('.interest'),
                inputs = document.querySelectorAll('input[type="number"]'),
                calc = 1,
                monthly = 0;
                
            calc = (inputs[0].value * inputs[1].value)/100;
            totalAmount = parseInt(inputs[0].value) + parseInt(calc);
            monthly = totalAmount/(inputs[2].value * 12);
      
            total.classList.remove('hide')
            total.innerHTML = 'Total Amount is: '+totalAmount.toFixed(2)+'<br>'+
                            'Monthly Payment is: '+monthly.toFixed(2)+'<br>'+
                            'Total Interest is: '+calc.toFixed(2)
        }
    </script>
</body>
</html>

Leave a Reply

Your email address will not be published.