accepts the area of a square and will calculate its perimeter.

Develop a program that accepts the area of a square and will calculate its perimeter.

View Answers

December 11, 2010 at 5:46 PM

Hi Friend,

Try the following code:

import java.util.*;
import java.text.*;
class  PerimeterOfSquare{
    public static void main(String[] args) 
    {
         DecimalFormat df = new DecimalFormat("##.00");
         Scanner input=new Scanner(System.in);
         System.out.println("Enter Area of Square:");
         double area=input.nextDouble();
         double side=Math.sqrt(area);
         System.out.println("Side of Square is: "+df.format(side));
         double perimeter=4*side;
         System.out.println("Perimeter of Square is: "+df.format(perimeter));

    }
}

Thanks









Related Tutorials/Questions & Answers:
accepts the area of a square and will calculate its perimeter.
accepts the area of a square and will calculate its perimeter.  Develop a program that accepts the area of a square and will calculate its perimeter... Area of Square:"); double area=input.nextDouble(); double side
Write a program to calculate area and perimeter of a circle
Write a program to calculate area and perimeter of a circle... example will teach you the method for preparing a program to calculate the area and perimeter of a circle. First of all name a class as "CircleArea"
Advertisements
How to calculate area of rectangle
How to Calculate Area of Rectangle       In this section we will learn how to calculate area.... To calculate the area of the rectangle define one method calculate which will calculate
How to calculate area of triangle
; In this section we will learn how to calculate area of triangle. We... variable. To calculate the area of triangle define the method triangle which will calculate the area of triangle. Then the program perform and  return
How to calculate area of Circle
How to Calculate Area of Circle   ... of calculating  the area of circle. In this program you will be taught each and every... the area of circle. After that it return the area of circle, return the doubles type
A Program to find area and perimeter of Rectangle
with the dot operator, invoking the method area(), which calculate the area and perimeter...A Program to find area and perimeter of Rectangle In this section we will explain you with the help of a program to find the area and perimeter of 
program
program  accepts the area of a square and will calculate its perimeter.   Hello Friend, Visit HereADS_TO_REPLACE_1 Thanks
java code
java code   Develop a program that accepts the area of a square and will calculate its perimeter
ModuleNotFoundError: No module named 'django-perimeter'
ModuleNotFoundError: No module named 'django-perimeter'  Hi, My... named 'django-perimeter' How to remove the ModuleNotFoundError: No module named 'django-perimeter' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'accepts'
ModuleNotFoundError: No module named 'accepts'  Hi, My Python... 'accepts' How to remove the ModuleNotFoundError: No module named 'accepts... to install padas library. You can install accepts python with following command
Write a program for calculating area and perimeter of a rectangle
Write a program for calculating area and perimeter of a rectangle... this lesson, you will be able to write program for calculating the area and perimeter.... Define the area as l*w and perimeter as 2*(l+w) and in the end use the catch
ModuleNotFoundError: No module named 'flask-accepts'
ModuleNotFoundError: No module named 'flask-accepts'  Hi, My... 'flask-accepts' How to remove the ModuleNotFoundError: No module named 'flask-accepts' error? Thanks   Hi, In your python
Square Elements of Two Dimensional Array
the two dimensional array program and its square. This session provide you... Square Elements of Two Dimensional Array   ..._TO_REPLACE_1 We are going to display the square of two matrix. Firstly, we
BlueJ (area of circle)
BlueJ (area of circle)  How does one write a program to calculate the area of a circle in BlueJ? Note that the user will have to provide the radius.   A simple program to calculate the area of a circle. radius provided
Square Root
Square Root  Hi, can any one please tell me the code to findout the square root of a given number with using built in function??? Thanks a lot in advance!! Regards: Akash
Method which returns area of circle - Java Beginners
of Circle : "+area); double perimeter = a.perimeterOfCircle(r...Method which returns area of circle  Need simple Java Method example that returns area of circle  Java Example CodeWith the help of given
Text Area
Text Area  how to browse an image in text area instead of giving url of particular image
MySQL Area
* b; end // delimiter ; Run Procedure to calculate area: You can run... MySQL Area       This example illustrates how to find the area of rectangle in MySQL. In this example
calculate average
calculate average  Question 2 cont.d Test case c: home works/labs 10 9 9 9 10 10 9 9 10 10 9 9 10 test scores: 65 89 note, the program should work with different numbers of home works/labs
Create an HTML form login.html that accepts the username and password
Create an HTML form login.html that accepts the username and password   Create an HTML form login.html that accepts the username and password and submits to login.java servlet. Verify credentials and on success, set the username
calculate average
calculate average   Design and write a java program to determine all three digit numbers such that the sum of the cubes of the digits is equal... and write a program and calculate your final average in this course. The details
calculate the time ..
calculate the time ..  [CODE] Elapsed Time Example <script type="text/javascript"> var startTime = null...="button" value="Calculate Difference" onclick="calculateTimeElapsed();" />
Calculate sum and Average in java
Calculate sum and Average in java  How to calculate sum and average in java program?   Example:- import java.io.BufferedReader; import.... The given code accepts the numbers from the user using BufferedReader class. Then using
calculate size of array
calculate size of array  Is it possible to calculate the size of array using pointers in Java
calculate reward points.
calculate reward points.  How to calculate reward points in a multiplex automation system
Area Tag in html5, Definition of <area> tag in HTML5.
Area Tag in html5, Definition of  <area> tag in html5 In this section we will discuss the use of <area> tag and about its implementation in the html document. The <area> tag is used for creating an area
print square of any number
print square of any number  using c++ language, write aprogram to print the square of any number entered by the user
ModuleNotFoundError: No module named 'calculate'
ModuleNotFoundError: No module named 'calculate'  Hi, My Python... 'calculate' How to remove the ModuleNotFoundError: No module named 'calculate' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'square'
ModuleNotFoundError: No module named 'square'  Hi, My Python... 'square' How to remove the ModuleNotFoundError: No module named 'square'... to install padas library. You can install square python with following command
Code to calculate hair density
Code to calculate hair density  Hello, Would you please give me a code to calculate the hair density on scalp from image in java
calculate sum of individual digit
calculate sum of individual digit   How calculate product of first and last digit of indiviual numbers Like a=43278 4*8=32
ModuleNotFoundError: No module named 'area'
ModuleNotFoundError: No module named 'area'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'area' How to remove the ModuleNotFoundError: No module named 'area' error
calculate sum of individual digit
calculate sum of individual digit  Hi How to calculate product of first snd last digit of indiviual digit Like Num=23456 S=2*6
Security in Web Service
) {   return "area of square of side"+side+" ... Develop a web service program for Square   area calculation...;Figure 9 Type the web service class name as square
area of a circle - Java Beginners
area of a circle  Write a class circle which consists of functions getdata() and area(), and also write a main program to create a circle object and to find the area by calling the function area () in circle class and display
square - Java Beginners
square  what is the java code to display the shape of "square"?  Hi friend, Code to display the shape of "square" import... SquareShape extends Frame { Shape square = new Rectangle2D.Double(100, 100,100
bean area - SQL
bean area  how to print bean area in excel sheet from oracle forms
How to calculate attending hours?
How to calculate attending hours?  I need to calculate attending hours of a employee in a day in my project to make their monthly salary . By using work starting time and ending time. How should I do it using Date class? Or any
How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year a parameter. Thanks   Hi, Please check the thread example
How to calculate the average in Hibernate?
How to calculate the average in Hibernate?  Hi, I have to calculate the average in Hibernate. How to calculate the average in Hibernate? Thanks   Hi, You can use the project in Hibernate. Here is the example code
Find Cylinder area By inputting value from user
Find Cylinder area By inputting value from user  Hello Sir I need the code for calculating the area of a cylinder in which it asks radius value from user and then calculate area using this radius value. Please provide me
printing hollow square
printing hollow square  Write an application (PrintingSquares.java) that prompts the user to enter the size of the side of a square, then displays a hollow square of that size made of asterisks. Your program should work
Artifacts of com.ms-square
List of Artifacts of com.ms-square maven depenency
Area Chart
Area Chart       In this section we are providing you an example to create a Area Chart. Description of ProgramADS_TO_REPLACE_1 For creating a Area Chart we use the object
MySQL Area
MySQL Area  This example illustrates how to find the area of rectangle in MySQL. In this example we create a procedure to find the area of rectangle. In the query below we declare two integer type variable w and h with default
Calculate factorial of a number.
Calculate factorial of a number.  How to calculate factorial of a given number?   import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Factorial { public static
How to create an area chart using jfreecharts?
How to create an area chart using jfreecharts?  i want to create an area chart that represents ip addresses of top countries. i have gone thru the area chart example using jfreechart but i am still not clear with its method. If u
calculate a list of products
calculate a list of products  Hi can you help me with this java program. This program should allow the user to order from a small catalogue of three items displayed on the screen, then calculate the user's final bill, including
calculate working hour
calculate working hour  why echo not come out? <html><body> <form action="<?php $_SERVER['PHP_SELF'];?>" method="post"> Working hour : <input name="workout" type="text"/><input name="submit1
ModuleNotFoundError: No module named 'date_calculate'
ModuleNotFoundError: No module named 'date_calculate'  Hi, My... named 'date_calculate' How to remove the ModuleNotFoundError: No module named 'date_calculate' error? Thanks   Hi, In your python