Question

*JAVASCRIPT QUESTION* Write a JavaScript program that calculates the area and perimeter of a square. Use...

*JAVASCRIPT QUESTION*

Write a JavaScript program that calculates the area and perimeter of a square.

Use document.write() for output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

<html>
<head>
<title>AREA AND PERIMETER OF A SQUARE</title>
</head>
<body>
<script language="JavaScript">
    function SQUARE()
    {
      var SIDE =document.FORM.TXTSIDES.value;
      document.write("<P>THE ARE OF SQUARE= " + (SIDE*SIDE) + "</p>");
      document.write("<P>THE PARIMETER OF SQUARE= " + (4* SIDE) + "</p>");
    }
    </script>
    <form NAME=FORM>
    ENTER SIDES OF SQUARE:
       <input TYPE="text" NAME="TXTSIDES" size=20>
       <br>
       <input TYPE="button" VALUE="CALCULATE" ONClick='SQUARE();'>
</form>
</script>
</body>
</html>

Add a comment
Know the answer?
Add Answer to:
*JAVASCRIPT QUESTION* Write a JavaScript program that calculates the area and perimeter of a square. Use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Write a program that determines the area and perimeter of a square. Your program should...

    1. Write a program that determines the area and perimeter of a square. Your program should accept the appropriate measurement of the square as input from the user and display the result to the screen. Area of Square = L (squared) Perimeter of Square = 4 * L 2.  Write a program that determines the area and circumference of a circle. Your program should accept the appropriate measurement of the circle as input from the user and display the result to...

  • Q2) Interface Create a program that calculates the perimeter and the area of any given 2D...

    Q2) Interface Create a program that calculates the perimeter and the area of any given 2D shape. The program should dynamically assign the appropriate calculation for the given shape. The type of shapes are the following: • Quadrilateral 0 Square . Perimeter: 4xL • Area:LXL O Rectangle • Perimeter: 2(L+W) • Area:LxW Circle Circumference: I x Diameter (TT = 3.14) Area: (TT xD')/4 Triangle (assume right triangle) o Perimeter: a+b+c O Area: 0.5 x base x height (hint: the base...

  • write a c programming Write a program that will calculate the perimeter, area and volume of...

    write a c programming Write a program that will calculate the perimeter, area and volume of a is is entered by the user. Your program will display the radius, perimeter, area and volume to the monitor and will also save them to a file called "circlePAV.txt". Your program should prompt the user for the radius until the user enters -1. Use the following structure. typedef struct ( float radius; float area, float perimeter; float volume; ylinder Figure>

  • Write a JavaScript program to calculate Area of a trapezoid Equation: Area = (top side +...

    Write a JavaScript program to calculate Area of a trapezoid Equation: Area = (top side + bottom side) * height / 2 1. Use prompt() function to take top side, bottom side, and height values from user 2. For validation, if user did not put in a number, your program must send out 3. "Input must be number" error message using alert() function. 4. If user put in all numbers, use alert() function to output correct answer

  • Write a JavaScript program to calculate Area of a trapezoid Equation: Area = (top side +...

    Write a JavaScript program to calculate Area of a trapezoid Equation: Area = (top side + bottom side) * height / 2 1. Use prompt() function to take top side, bottom side, and height values from user 2. For validation, if user did not put in a number, your program must send out 3. "Input must be number" error message using alert() function. 4. If user put in all numbers, use alert() function to output correct answer

  • Calculate the area and perimeter(circumference) of a circle. Print the area and perimeter(circumference) Use a radius...

    Calculate the area and perimeter(circumference) of a circle. Print the area and perimeter(circumference) Use a radius of 15 to test your program, calculations should have 2 decimal places. In C++, please use visual studios, and show the output.

  • Using Javascript! Write a program that calculates the amount of money a person would earn over...

    Using Javascript! Write a program that calculates the amount of money a person would earn over a period of time if his or her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should ask the user for the number of days. Display a table showing what the salary was for each day, and then show the total pay at the end of the period. The output should be...

  • This is Force 2.0 with Fortran 77: ! Program to find the area and perimeter of...

    This is Force 2.0 with Fortran 77: ! Program to find the area and perimeter of a circle program circle implicit none ! Variable declaration real :: area, perimeter, radius real parameter :: pi = 3.142 ! Calculating the area write(*,*) 'Enter the radius of a circle' read(*,*)radius area = pi * radius **2 write(*,*) 'The area of the circle is:', area !Calculating the perimeter perimeter = 2*pi*radius write(*,*) 'The perimeter of the circle is:', perimeter PAUSE end program circle...

  • Java Write a program to print the perimeter and area of rectangles using all combinations of...

    Java Write a program to print the perimeter and area of rectangles using all combinations of heights and widths running from 1 foot to 10 feet in increments of 1 foot. Print the output in headed, formatted columns.

  • 5. (30 pts) Write a program that calculates the surface area of a cube (see the...

    5. (30 pts) Write a program that calculates the surface area of a cube (see the formula below). The user inputs the cube's side length and your program will then print out the surface area of that cube. Your code must follow the output in the sample run below. Your program must be complete and correct, but you do not need to include comments. Here is the formula to calculate surface area given a cube's side length: surface area 6...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT