Write a java program that compute the circumference and area of a circle from the user input for a radius.
Area_and_Circumofcircle.java
import java.util.Scanner;//keyboard inputting
public class Area_and_Circumofcircle
{//main class
public static void main(String[] args)
{//main method
int r;
double pi = 3.14, area,circumference;
Scanner s = new Scanner(System.in);
System.out.print("Enter radius of circle:");
r = s.nextInt();//keyboard inputting
area = pi * r * r;//area of circle
circumference=2*pi*r;//circumference of circle
System.out.println("Area of circle:"+area);
System.out.println("Circumference of circle"+circumference);
}
}
output
Enter radius of circle:5
Area of circle:78.5
Circumference of circle31.400000000000002
Write a java program that compute the circumference and area of a circle from the user...
Write a program that calculates the area and circumference of a circle. It should ask the user first to enter the number of circles n, then reads the radius of each circle and stores it in an array. The program then finds the area and the circumference, as in the following equations, and prints them in a tabular format as shown in the sample output. Area = πr2 , Circumference = 2πr, π = 3.14159 Sample Output: Enter the number...
Write a Java console application that prompts the user to enter the radius of a circle, then prints its radius, diameter, circumference, and area. Write a JavaFX GUI application to do the same calculation, and draw the circle. The Console Output Enter the radius of the circle: 1.2 The radius is 1.2 The diameter is 2.4 The circumference is 7.5398223686155035 The area is 4.523893421169302 Write and document your program per class coding conventions. Add an instance variable double radius. Generate...
Using the algorithm information below, program a calculator for the area and circumference of a circle. Answer in C LANGUAGE !! Algorithm for Area and Circumference of a Circle: Inputs: - radius of the circle Outputs: - the area of the circle - the circumference of the circle Relevant Constants and Formulas: - area of a circle = PI x Radius x Radius - circumference of a circle = 2 x PI X Radius Main Algorithm (numbered steps) 1. Input...
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...
Java Write a program that prompt the user to enter a decimal number representing the radius of a circle. If the number is greater or equal to zero, the program displays the area of the circle. Otherwise, the program displays “negative input”
Please write in JAVA ONLY Please use a dialog box to prompt the user to enter the radius for a circle (radius should be a double). Then, use a Message Box to display the Radius, Area and Circumference of the circle with that Radius. You will use the Math class constant Math.PI to calculate the Area and Circumference.
Write a java class definition for a circle object. The object should be capable of setting radius, and computing its area and circumference. Use this to create two Circle objects with radius 10 and 40.5, respectively. Print their areas and circumference. Here is the Java class file (Circle.java). Compile it. public class Circle{ //Instance Variables private double PI = 3.1459; private double radius; //Methods public Circle ( ) { } //get method (Accessor Methods ) public double getRadius (...
Write a function that prints the area and circumference of a circle for a given radius. Only the radius is passed to the function. The function does not return any values. The area is given by π r2 and the circumference is 2 π r.
Write a program that prompts for and reads the Circumference of a circle as a floating point value (double) then print the radius of the circle
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.