Skip to content

dharunraj08/mathserver

 
 

Repository files navigation

Ex.05 Design a Website for Server Side Processing

Date:07/10/2025

AIM:

To design a website to calculate the power of a lamp filament in an incandescent bulb in the server side.

FORMULA:

P = I2R P --> Power (in watts) I --> Intensity R --> Resistance

DESIGN STEPS:

Step 1:

Clone the repository from GitHub.

Step 2:

Create Django Admin project.

Step 3:

Create a New App under the Django Admin project.

Step 4:

Create python programs for views and urls to perform server side processing.

Step 5:

Create a HTML file to implement form based input and output.

Step 6:

Publish the website in the given URL.

PROGRAM :

<!DOCTYPE html>
<html>
<head>
    <h2>DHARUN DHANRAJ R (25017737)</h2>
<center>
<title>Power Calculator</title>
</center>  
</head>
<body>
  <h2>Power Calculator</h2>
  <p>(Power) equals to I² (square of current) times R (Resistance)</p>

  <label>Current (amperes):</label>
  <input type="number" id="current"><br><br>

  <label>Resistance (ohms):</label>
  <input type="number" id="resistance"><br><br>

  <button onclick="calculatePower()">Calculate Power</button><br><br>

  <label>Power (watts):</label>
  <input type="text" id="power" readonly style="background-color:#dedada;"><br><br>

  <script>
    function calculatePower() {
      let current = parseFloat(document.getElementById("current").value);
      let resistance = parseFloat(document.getElementById("resistance").value);

      if (isNaN(current) || isNaN(resistance)) {
        alert("Please enter valid numbers for current and resistance.");
        return;
      }

      let power = current * current * resistance;
      document.getElementById("power").value = power.toFixed(2) + " W";
    }
  </script>
</body>
</html>

SERVER SIDE PROCESSING:

alt text

HOMEPAGE:

alt text

RESULT:

The program for performing server side processing is completed successfully.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 83.9%
  • HTML 16.1%