Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners accepts the area of a square and will calculate its perimeter.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


NareshChowdary
accepts the area of a square and will calculate its perimeter.
1 Answer(s)      3 years and 10 months ago
Posted in : Java Beginners


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


Advertisement
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... input=new Scanner(System.in); System.out.println("Enter Area of Square
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... rectangle method which takes two parameters of type integer. To calculate the area
How to calculate area of triangle
; In this section we will learn how to calculate area of triangle. We... the area of triangle define the method triangle which will calculate the area... .style1 { margin-right: 0px; } How to Calculate
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 
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.... This is an instance of class method and is used to convert a string to an integer. Define the area
java code
java code   Develop a program that accepts the area of a square and will calculate its perimeter
program
program  accepts the area of a square and will calculate its perimeter.   Hello Friend, Visit Here Thanks
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
Square Elements of Two Dimensional Array
the two dimensional array program and its square. This session provide you... Square Elements of Two Dimensional Array   ...: We are going to display the square of two matrix. Firstly, we have to define
Text Area
Text Area  how to browse an image in text area instead of giving url of particular image
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
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
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
MySQL Area
; Run Procedure to calculate area: You can run MySQL stored procedure by using... MySQL Area       This example illustrates how to find the area of rectangle in MySQL. In this example
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
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
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
calculate the time ..
calculate the time ..  [CODE] Elapsed Time Example <script type="text/javascript"> var startTime = null...="button" value="Calculate Difference" onclick="calculateTimeElapsed();" />
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
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
Security in Web Service
) {   return "area of square of side"+side+" ... Develop a web service program for Square   area calculation... the web service class name as square Type the package name 
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
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
bean area - SQL
bean area  how to print bean area in excel sheet from oracle forms
calculate reward points.
calculate reward points.  How to calculate reward points in a multiplex automation system
calculate size of array
calculate size of array  Is it possible to calculate the size of array using pointers in Java
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 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
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
Advertisements
 

 

 

DMCA.com