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

 
 


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

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 Pages:
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"
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
program
program  accepts the area of a square and will calculate its perimeter.   Hello Friend, Visit Here Thanks
java code
java code   Develop a program that accepts the area of a square and will calculate its perimeter
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
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
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 
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
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
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
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
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
Area Chart
Area Chart       In this section we are providing you an example to create a Area Chart. Description of Program For creating a Area Chart we use the object
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
Use Constructor in JSP
example, we are calculating the Area and Perimeter of Square. For this, class X...=4 and calculate the result by area=side*side and perimeter=4*side. Here...; class X { int side; int area; int perimeter
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
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
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
Plz Provide correct program code for all questions.
of n numbers? Develop a program that accepts the area of a square and will calculate its perimeter. Develop the program calculateCylinderVolume., which accepts... disk and its height and computes surface area of the cylinder. Develop the program
Java example to calculate the execution time
Java example to calculate the execution time  ... will describe you the way that how one can calculate or get the execution time... is done with its working we have stored the current time into another variable
Text Area
Text Area  how to browse an image in text area instead of giving url of particular image
Please help me... its very urgent
Please help me... its very urgent  Please send me a java code to check whether INNODB is installed in mysql... If it is there, then we need to calculate the number of disks used by mysql
method overriding in java
method overriding in java  program to compute area of square,rectangle,triangle,circle and volume of sphere,cylinder and perimeter of a cube using method overriding
method overriding in java
method overriding in java  program to compute area of square,rectangle,triangle,circle and volume of sphere,cylinder and perimeter of a cube using method overriding
Having a hard time writing program to calculate test scores..........
Having a hard time writing program to calculate test scores.......... ... school is giving a standardized test to all of its students. There are 50... into the array. Then calculate and output the following statistics: average score
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
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
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   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();" />
Add Area of Two Figures
Add Area of Two Figures       This section illustrates you how to add area of two specified figures... rectangle and oval respectively. Object of class Area is created to pass
JPanel - Drawing Area
Java: JPanel - Drawing Area   To use a JPanel for graphics  ...; Example of drawing panel drawing area.   Define a subclass of JPanel and override paintComponent()   Create a subclass of JPanel to override its
JPanel - Drawing Area 2
Java: JPanel - Drawing Area 2   To initialize the panel... To find the size of the drawing area Use drawing.getWidth... = getHeight(); // get its height. g.drawLine(0, 0, w, h); // upper left
java code - Java Beginners
("Area and Perimeter of Square with side "+ side); } Shape(long length,long breadth){ System.out.println("Area and Perimeter of Rectangle with length... packages. 2)Java program to find the area and volume of square,rectangle,circle
according to me its ok but is calculating wrong values in
according to me its ok but is calculating wrong values in   program to calculate roman numbers .....i.e roman number calculator import java.util.*; import java.io.*; class romancalci { public static void main(String
pls answer these question
the rectangleâ??s area and perimeter.   import java.io.*; class rectangle...()); int area=l*b; int perimeter=(2*l)+(2*b); System.out.println("Area of Rectangle: "+area); System.out.println("Perimeter of Rectangle
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 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
Writing a Program to calculate Circumference of planets reading from a file and writing to new file.
Writing a Program to calculate Circumference of planets reading from a file... to then calculate the circumference of the planets. I then have to output the data into a new... and 1 can be defined as constants // Be sure NOT to calculate
Subtract Area between two Figures
Subtract Area between two Figures       This section illustrates you how to subtract the area between... provides the rectangle and oval shape respectively. Object of class Area
Change the user input to integer
a method parseInt(). In this program we are going to calculate a area... in the method show() and the area will be calculated by calculate() method.... In the first class we have used two methods, show(int x, int y) and calculate(). First
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
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7
Square pattern in java using for loop
Square pattern in java using for loop  please explain the logic to program the following using for loop in Java: 1 3 5 7 9 3 5 7 9 1 5 7 8 1 3 7 9 1 3 5 9 1 3 5 7

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.