CODE IDEAL WEIGHT CALCULATOR IN HTML CSS AND JAVASCRIPT

  1. User-Friendly Interface: Simple, centered layout with a responsive design and attractive color gradient background.
  2. Gender Selection: Allows users to select their gender, which affects the calculation of ideal weight.
  3. Age, Height, and Weight Input: Users can input their age, height (in cm), and weight (in kg) to calculate BMI and ideal weight.
  4. Buttons for Actions:
    • Calculate Button: Calculates and displays the ideal weight and BMI based on the inputs.
    • Clear Button: Clears all input fields and resets the display elements.
    • History Button: Shows the user’s BMI and weight history in an alert box.
  5. Ideal Weight Calculation: Calculates ideal weight based on gender and height, with a different formula for males and females.
  6. BMI Calculation: Computes BMI from weight and height, then displays the result with an emoji and advice.
  7. Result Display: Displays the ideal weight and BMI values along with relevant icons and styling.
  8. Health Advice and Tips:
    • Provides personalized health advice based on BMI categories (underweight, normal, overweight, obese).
    • Offers tips for each category, such as dietary and lifestyle suggestions.
  9. Progress Bar: Shows a visual representation of BMI status, where the width adjusts according to the BMI category (e.g., 25% for underweight, 50% for normal, etc.).
  10. Icon Indicators: Displays an emoji next to the result to represent different BMI statuses, making it visually engaging.
  11. Animations:
    • Fade-in effect on the main calculator container for a smoother UI experience.
    • Slide-in effect for the result display, enhancing visual appeal.
  12. Local Storage for History: Saves previous calculations (gender, age, height, weight, ideal weight, BMI) in the browser’s local storage, allowing users to view their history of calculations.
  13. Data Validation: Checks if the input values for age, height, and weight are valid numbers, displaying a warning if any are missing or invalid.
  14. Responsive Design: Adjusts for various screen sizes to ensure a consistent user experience.
  15. Tooltips and Placeholder Icons: Adds emojis to placeholders and labels for a friendly and intuitive interface.
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>🌟 Ideal Weight & BMI Calculator 🌟</title>
    <style>
        /* Basic styling and animations */
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(120deg, #f6d365, #fda085);
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            color: #333;
            overflow: hidden;
        }

        .calculator-container {
            background-color: #ffffff;
            padding: 2em;
            border-radius: 12px;
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
            text-align: center;
            width: 400px;
            animation: fadeIn 1s ease-out;
            position: relative;
        }

        h1 {
            color: #333;
            font-size: 24px;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        h1::before {
            content: "🧮";
            margin-right: 8px;
        }

        label {
            display: block;
            margin-top: 10px;
            font-weight: bold;
        }

        input[type="number"], select {
            width: 100%;
            padding: 10px;
            margin-top: 8px;
            border-radius: 5px;
            border: 1px solid #ddd;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        input[type="number"]:focus, select:focus {
            border-color: #fda085;
            outline: none;
        }

        .button-container {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-top: 20px;
        }

        .calculate-btn, .clear-btn, .history-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s ease;
        }

        .calculate-btn {
            background: #fda085;
            color: #fff;
        }

        .calculate-btn:hover {
            background: #f6d365;
        }

        .calculate-btn::before {
            content: "💪";
            margin-right: 8px;
        }

        .clear-btn {
            background: #e0e0e0;
            color: #333;
        }

        .clear-btn:hover {
            background: #ccc;
        }

        .history-btn {
            background: #82c91e;
            color: #fff;
        }

        .history-btn:hover {
            background: #63a917;
        }

        .result, .advice, .tips {
            margin-top: 20px;
            font-size: 18px;
            font-weight: bold;
            color: #444;
            animation: slideIn 1s ease-in-out;
        }

        .result-icon {
            font-size: 2em;
            margin-top: 15px;
        }

        .advice {
            font-size: 16px;
            color: #666;
            margin-top: 10px;
        }

        .tips {
            font-size: 14px;
            color: #888;
            font-style: italic;
        }

        .progress-bar-container {
            width: 100%;
            background-color: #eee;
            border-radius: 5px;
            margin-top: 15px;
        }

        .progress-bar {
            height: 10px;
            border-radius: 5px;
            background-color: #82c91e;
            width: 0;
            transition: width 1s ease;
        }

        /* Animations */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="calculator-container">
        <h1>Ideal Weight & BMI Calculator</h1>
        <label for="gender">Gender: 👤</label>
        <select id="gender">
            <option value="male">Male 🚹</option>
            <option value="female">Female 🚺</option>
        </select>

        <label for="age">Age: 🎂</label>
        <input type="number" id="age" placeholder="Enter age">

        <label for="height">Height (cm): 📏</label>
        <input type="number" id="height" placeholder="Enter height in cm">

        <label for="weight">Current Weight (kg): ⚖️</label>
        <input type="number" id="weight" placeholder="Enter weight in kg">

        <div class="button-container">
            <button class="calculate-btn" onclick="calculateIdealWeight()">Calculate</button>
            <button class="clear-btn" onclick="clearInputs()">Clear</button>
            <button class="history-btn" onclick="showHistory()">History</button>
        </div>

        <div id="result" class="result"></div>
        <div class="progress-bar-container">
            <div id="progressBar" class="progress-bar"></div>
        </div>
        <div id="resultIcon" class="result-icon"></div>
        <div id="advice" class="advice"></div>
        <div id="tips" class="tips"></div>
    </div>

    <script>
        let history = [];

        function calculateIdealWeight() {
            const gender = document.getElementById("gender").value;
            const age = parseInt(document.getElementById("age").value);
            const height = parseFloat(document.getElementById("height").value);
            const weight = parseFloat(document.getElementById("weight").value);
            const resultDiv = document.getElementById("result");
            const resultIconDiv = document.getElementById("resultIcon");
            const adviceDiv = document.getElementById("advice");
            const tipsDiv = document.getElementById("tips");
            const progressBar = document.getElementById("progressBar");

            if (isNaN(height) || height <= 0 || isNaN(weight) || weight <= 0 || isNaN(age) || age <= 0) {
                resultDiv.textContent = "❌ Please enter valid age, height, and weight.";
                resultIconDiv.innerHTML = "⚠️";
                adviceDiv.textContent = "";
                tipsDiv.textContent = "";
                return;
            }

            let idealWeight;
            if (gender === "male") {
                idealWeight = 50 + 0.9 * (height - 152);
            } else {
                idealWeight = 45.5 + 0.9 * (height - 152);
            }

            const heightInMeters = height / 100;
            const bmi = weight / (heightInMeters * heightInMeters);
            resultDiv.textContent = `✨ Ideal Weight: ${idealWeight.toFixed(1)} kg | BMI: ${bmi.toFixed(1)}`;
            resultIconDiv.innerHTML = bmi > 0 ? "💪" : "";

            if (bmi < 18.5) {
                adviceDiv.textContent = "📉 Underweight: Consider a balanced diet to gain weight.";
                tipsDiv.textContent = "Tip: High-calorie foods and strength training can help.";
                progressBar.style.width = "25%";
            } else if (bmi >= 18.5 && bmi <= 24.9) {
                adviceDiv.textContent = "✅ Normal: Keep up the good work and maintain a healthy lifestyle!";
                tipsDiv.textContent = "Tip: A balanced diet and regular exercise can keep you on track!";
                progressBar.style.width = "50%";
            } else if (bmi >= 25 && bmi <= 29.9) {
                adviceDiv.textContent = "⚠️ Overweight: Consider regular exercise and a balanced diet.";
                tipsDiv.textContent = "Tip: Reduce processed food and increase physical activity.";
                progressBar.style.width = "75%";
            } else {
                adviceDiv.textContent = "❗ Obese: Consult a healthcare provider for personalized advice.";
                tipsDiv.textContent = "Tip: Consult a doctor for a personalized health plan.";
                progressBar.style.width = "100%";
            }

            history.push(`Gender: ${gender}, Age: ${age}, Height: ${height} cm, Weight: ${weight} kg, Ideal Weight: ${idealWeight.toFixed(1)} kg, BMI: ${bmi.toFixed(1)}`);
            localStorage.setItem("bmiHistory", JSON.stringify(history));
        }

        function clearInputs() {
            document.getElementById("age").value = "";
            document.getElementById("height").value = "";
            document.getElementById("weight").value = "";
            document.getElementById("result").textContent = "";
            document.getElementById("resultIcon").innerHTML = "";
            document.getElementById("advice").textContent = "";
            document.getElementById("tips").textContent = "";
            document.getElementById("progressBar").style.width = "0%";
        }

        function showHistory() {
            const savedHistory = localStorage.getItem("bmiHistory");
            if (savedHistory) {
                alert("History:\n" + JSON.parse(savedHistory).join("\n"));
            } else {
                alert("No history available.");
            }
        }
    </script>
</body>
</html>
JavaScript

Completion of the 220 kV Chilime–Trishuli Transmission Line:

The construction of the 220 kV Chilime–Trishuli transmission line, regarded as vital for channeling electricity generated by hydropower projects on the Trishuli River and its tributaries into the national grid, has been completed.

The transmission line spans 28 kilometers, extending from the Chilime Hub Substation in Thambuchet, Aamachodingmo Rural Municipality, Rasuwa, to the Trishuli 3B Hub Substation in Pahrebesi, Kispang Rural Municipality, Nuwakot.

Nepal Electricity Authority (NEA) Executive Director Kulman Ghising stated that NEA employees and contractors worked day and night, even during public holidays like Dashain and Tihar, to complete the construction.

According to Ghising, the transmission line infrastructure is now ready to carry power from ongoing and planned hydropower projects in Rasuwa, including the 111 MW Rasuwagadhi and the 42.5 MW Sanjen projects, developed under the leadership of NEA’s subsidiary, Chilime Hydropower. Both Rasuwagadhi and Sanjen projects are near completion and ready for power generation.

Ghising highlighted the project’s challenges due to the rugged and risky Himalayan terrain, where towers were constructed on steep cliffs without road access. Materials, gravel, and water had to be transported manually or by mules. The project faced additional challenges from landslides, forest area land usage, local obstructions, and adverse weather conditions.

Efforts are also underway to build the Chilime–Kerung cross-border transmission line to facilitate electricity trade with neighboring China. The Chilime–Trishuli transmission line will serve as the connecting link to China. The construction of 220/132/33 kV substations at the Chilime and Trishuli 3B hubs has been completed as part of this project.

Electricity from the Trishuli 3B Hub Substation will integrate into the national grid via the Trishuli–Kathmandu 220 kV transmission line, reaching Matatirtha, Kathmandu. Power from the Sanjen and Rasuwagadhi projects will connect to the Chilime Hub Substation and then to the national grid through the Chilime–Trishuli transmission line.

Seventy-six towers have been built for the transmission line, covering terrain ranging from 680 to 2,600 meters above sea level. Of these, 33 towers were constructed in areas without road access, necessitating the creation of access roads.

Director Tharka Bahadur Thapa from NEA’s High Voltage Grid Department noted that more than 20 kilometers of access roads were built, and materials were transported by mules, people, and even helicopters to construct two towers. In one challenging section, a 1,235-meter-long wire was strung across the Mailung River gorge (Mailung Crossing) using drones.

The Chilime–Mailung section covers 20 kilometers with a double-circuit line, and the Mailung–Trishuli 3B Hub section spans eight kilometers with a four (multi)-circuit line. The multi-circuit line will also connect the under-construction 216 MW Upper Trishuli-1 hydropower project, led by a Korean company, with Upper Trishuli-1 covering 60% of the construction costs for the multi-circuit line.

The Chilime–Trishuli project has an estimated cost of USD 362.89 million, funded by the Government of Nepal, NEA, and a grant from the German Development Bank (KfW), with concessional loans from the European Investment Bank (EIB), established by the European Union.

The contract for the transmission line and substations was awarded to Pinggao Group of Companies, a Chinese firm, in November 2017, and became effective in December 2017.

error: Content is protected !!
Scroll to Top
MacroNepal
Verified by MonsterInsights