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




Have Programming Question? Ask it here!
 
 
 


Tony Q
Radius Program
1 Answer(s)      4 years and 3 months ago
Posted in : Java Beginners


I need to write, compile, and execute a Java application program that calculates and outputs the circumference of a circle. Any ideas? thanks!!

Advertisement
View Answers

January 18, 2010 at 11:08 AM


Hi Friend,

Try the following code:

import java.util.*;
class Circumference{

final static double pi=3.14;
public static double circum(double r){
return 2*pi*r;
}
public static void main(String[]args){
Scanner input=new Scanner(System.in);
System.out.println("Enter radius: ");
double r=input.nextDouble();
double circumferenceOfCircle=Circumference.circum(r);
System.out.println("Circumference of Circle: "+circumferenceOfCircle);
}
}

Thanks


Related Tutorials/Questions & Answers:
Radius Program - Java Beginners
Radius Program  I need to write, compile, and execute a Java application program that calculates and outputs the circumference of a circle. Any ideas...){ Scanner input=new Scanner(System.in); System.out.println("Enter radius
program
program  Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder
Advertisements
java program
java program  Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall
java program
java program  . Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall
program
program  any program of hotel or school management
program
program  write a javascript program to create a application form with validation
program
program  write a html program in show table and this word in box
program
program  program of jdbc using ms access for creating table
program
program  write a program different between to dates in terms of days in java
program
program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
program
program  write a program reversee a string. input-hi this is roseindia output-roseindia is this hi
program
program  develop a servlet to insert the data in the database from our program in the table stored in the database
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program   An old-style movie theater has a simple profit program. Each customer pays $5 per ticket. Every performance costs the theater $20, plus $.50 per attendee. Develop the program calculateTotalProfit that consumes
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link: Java Threads Thanks
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
program
program  Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time, and the Pythagorean
program
program  how to improve programming skills plss tell some tips..i am understanding concepts but unable to write program so,pls give some guideness plsss
Program
Program  a program to prove that default constructor of super class is available to subclass by default. Define a parameterize constructor for super class to store name = ‚??Tommy‚?? age=‚??23‚?? and call this constructor
Program
Program  a program to create two classes Commercial and Domestic. Override the method calculatebill() of Commercial class(Rs.8 per unit) into Domestic class(Rs 6 per unit) to compute electricity bill for both classes
program
program  no i want a program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation... in rectangles or circles wat ever it may be. the theme of program is to show algorithm
program
program  . Develop a program that accepts an initial amount of money (called the principal), a simple annual interest rate, and a number of months will compute the balance at the end of that time. Assume that no additional
program
program  Write a JSP Program, which displays a web page containing the name of the Courses, Courses being offered currently, number of students enrolled in each course, new courses to be offered, eligibility criteria for taking
program
program  i want a progra in java to print a sentence in alphabetic order, taking the input from the user.the program should writen without using the array for example : if input= this is a cat then output sould = a cat
program
program  Utopias tax accountants always use programs that compute income taxes even though the tax rate is a solid, never-changing 15%. Define the program calculateTax which determines the tax on the gross pay. Define
program
program  Write a JSP Program, which displays a web page containing two web links one for your profiling and other for the schedule of theory of practical classes of your Batch. When one click on link for getting your profile
program
program  Write a program to print details of a week for a particular day using array of objects Integer and String. OUTPUT: First Day of Week is Monday Second Day of Week is Tuesday Third Day of Week is Wednesday Forth Day
Java Program - Java Beginners
Java Program  Write a Java program that accepts the radius of a circle and displays the options as follows : 1. find diameter of a cicle.(2* radius) 2. find area of circle.(  * radius * radius) 3. find circumference
program help - Java Beginners
program help  In the following code, I want to modify class figure...(String[]args) { int radius,len,wid,choice; Vector myVector=new Vector...; switch(choice) { case 1: System.out.println("Enter radius
java program
:open akash enter a decimal: 10.25 name: value (2) WAP to take the input radius...: enter the radius:5 the area of the circle with radius 5 is 78.5
Java method final parameter
. In the example the radius parameter for calculating the area of circle have been set to final. This means double type radius is no more a variable... the constant declared parameter radius inside the class constructor FinalParameterExample
java sample program - Java Beginners
java sample program  hai i need a sample program... Circle extends Shape { int radius=5; void area() { System.out.println(3.14*radius*radius); } } class Polymorphism { public static void
Java program? - Java Beginners
Java program?  In order for an object to escape planet's.... The escape velocity varies from planet to planet.Create a Java program which calculates the escape velocity for the planet. Your program should first prompt
write a java program that implements the following classes:
write a java program that implements the following classes:  write a java program that implements the following classes: A) a) Point in the Cartesian coordinate system. b) Circle with a given center and radius c) Cylinder
program calculateCylinderVolume
program calculateCylinderVolume  program calculateCylinderVolume
Java GUI Program - Java Beginners
Java GUI Program  How is the following program supposed to be coded? Write an application that prompts the user to enter the radius of a circle by Day 7 under a thread in your Team Forum called Week Three Program for 10 points
java program for
java program for   java program for printing documents,images and cards
inheretance java program - Java Beginners
radius; private Point k; public Circle (double r, int x, int y) { radius=r; k=new Point (x,y); } public Circle() { Point k...() { return(2*3.1416)*radius; } public double calculateArea() { return
program in java
program in java  a program to develop a client, server application to satisfy the requests from multiple clients
program in java
program in java  a program to develop a client, server application to satisfy the requests from multiple clients
string program
string program  write a program to print the pattern p r o program r a m
program of c
program of c  write a program in c to display a to z without using printf or scanf statements or header files
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
program for factorial
program for factorial  how to set size of buttons on frame
program for factorial
program for factorial  how to set size of buttons on frame
Java Program
Java Program  A Java Program that print the data on the printer but buttons not to be printed
java program
java program  write a program to print 1234 567 89 10
Jsp program
Jsp program  A sample program of jsp using dml quaries
program coding
program coding  how to rearrange the array a[1]. . a[n] even elements and odd elements? please give the example coding program
Java program
Java program  Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any type of numeric values and returns the results
Advertisements
 

 

 

DMCA.com