Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Dhayanitha/scriptproject

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mathematical Calculations using JavaScript

AIM:

To design a website to calculate the area of a circle and volume of a cylinder using JavaScript.

DESIGN STEPS:

Step 1:

Requirement collection.

Step 2:

Creating the layout using HTML and CSS.

Step 3:

Write JavaScript to perform calculations.

Step 4:

Choose the appropriate style and color scheme.

Step 5:

Validate the layout in various browsers.

Step 6:

Validate the HTML code.

Step 6:

Publish the website in the given URL.

PROGRAM:

volume of cylinder html

{% load static %}
<!DOCTYPE html>
<html>

<head>
    <title>volumeofcylinder</title>
    <link rel="stylesheet" href="{% static 'css/mathvolume.css' %}">
</head>

<body>
    <div class="container">
        <div class="formview">
            <div class="banner">
                VOLUME OF CYLINDER
            </div>
            <div class="content">
                <form action="" method="GET">
                    {% csrf_token %}
                    <div class="forminput">
                        <label for="value_radius">radius=</label>
                        <input type="text" name="value_radius" id="value_radius">
                    </div>
                    <div  class="forminput">
                        <label for="value_height">height=</label>
                        <input type="text" name="value_height" id="value_height">
                    </div>                    
                    <div class="forminput">
                        <button type="button" name="button_volume" id="button_volume">volume</button>
                    </div>
                    <div  class="forminput">
                        <label for="value_c">answer=</label>
                        <input type="text" name="value_c" id="value_c" readonly>
                    </div> 
                </form>
            </div>
        </div>
    </div>
    <script src="/static/js/mathvolume.js"></script>
</body>

</html>

volume of cylinder javescript

volumeBtn = document.querySelector('#button_volume');

volumeBtn.addEventListener('click',function(e){ txtR = document.querySelector('#value_radius'); txtH = document.querySelector('#value_height'); txtC = document.querySelector('#value_c');

let c;

c = 3.14*parseFloat(txtR.value)*parseFloat(txtR.value)*parseFloat(txtH.value);

    txtC.value = c;

});

area of circle html

{% load static %}
<!DOCTYPE html>
<html>

<head>
    <title>areaofcircle</title>
    <link rel="stylesheet" href="{% static 'css/matharea.css' %}">
</head>

<body>
    <div class="container">
        <div class="formview">
            <div class="banner">
                AREA OFCIRCLE
            </div>
            <div class="content">
                <form action="" method="GET">
                    {% csrf_token %}
                    <div class="forminput">
                        <label for="value_radius">radius=</label>
                        <input type="text" name="value_radius" id="value_radius">
                    </div>                  
                    <div class="forminput">
                        <button type="button" name="button_area" id="button_area">area</button>
                    </div>
                    <div  class="forminput">
                        <label for="value_c">answer=</label>
                        <input type="text" name="value_c" id="value_c" readonly>
                    </div> 
                </form>
            </div>
        </div>
    </div>
    <script src="/static/js/matharea.js"></script>
</body>

</html>

area of circle javascript

areaBtn = document.querySelector('#button_area');

areaBtn.addEventListener('click',function(e){ txtR = document.querySelector('#value_radius'); txtC = document.querySelector('#value_c');

let c;

c = 3.14*parseFloat(txtR.value)*parseFloat(txtR.value)

    txtC.value = c;

});

OUTPUT:

output

output

CODE VALIDATOR:

output

output

RESULT:

Thus a website is designed for the maths calculation and is hosted in the URL http://dhayanitha.student.saveetha.in:8000/mathvolumeofcylinder and http://dhayanitha.student.saveetha.in:8000/matharea . HTML code is validated.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 45.4%
  • HTML 28.5%
  • CSS 18.8%
  • JavaScript 7.3%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.