# Java Programming

Question :

Write a java program to find circumference and area of a circle. Your program should be fulfill following requirements.
 Radius of the circle should be read in the main method of the program
 Circumference and Area should be calculated at the circumference() and area() methods.
 Circumference and Area should be displayed at the main method.

import java.util.Scanner;

class circles{
public static void main(String [] args){}

Scanner in = new Scanner(System.in);

double c1 = circumference(c);
System.out.print("Circumference of the circle is = "+c1);

double a1 = area(a);
System.out.print("Area of the circle is = "+a1);

static double circumference(int r){

double c = 2*3.14*r;
return c;
}

static double area(int r){

double a = 3.14*r*r;
return a;
}

}

Could anyone please point out the mistakes of my code?

Thanks!

1. 👍
2. 👎
3. 👁
4. ℹ️
5. 🚩
1. looks ok
is there a reason you restrict r to integer values? Maybe because you only know about integer input?

Did you actually run it? check your results with a calculator?
As my first employer (a former NASA engineer) liked to say,
One measurement is worth a thousand expert opinions.

1. 👍
2. 👎
3. ℹ️
4. 🚩
👤
oobleck

## Similar Questions

1. ### Algebra

A survey about the student government program at a school finds the following results: 190 students like the program 135 students think the program is unnecessary 220 students plan on running for student government next year. If a

2. ### Math

A survey about the student government program at a school finds that of 245 students: • 218 students like the program • 27 students think the program is unnecessary If a circle graph were made from this data, what would the

3. ### Math

Note: Enter your answer and show all the steps that you use to solve this problem in the space provided. A survey about the student government program at a school finds the following results: 190 students like the program 135

4. ### Math

A survey of 594 studnets about the sports program at a school finds the following results: 495 students like the program 99 students think the program is inadequate. If a circle graph were made from the data, what would the

1. ### Math

So my question is find the circumference of the circle in terms of Pi then use the approximation 3.14 for pi and approximate the circumference. How would I do this? The radius of the circle is 2m.

2. ### Math

A survey about the student government program at a school finds the following results. 190 students like the program 135 students think the program is unnecessary 220 students plan on running for student government next year. If a

3. ### Math

17. A survey of 594 students about the sports program at a school finds the following results: 528 students like the program 66 students think the program is inadequate. If a circle graph were made from the data, what would the

4. ### Math

2. A survey about the student government program at a school finds the following results: 190 students like the program, 135 students think the program is unnecessary, and 220 students plan on running for student government next

1. ### C++

Write a program which finds the age and name of the oldest person in a group. const int SIZE = 8; int age[SIZE] = { 21, 42, 26, 22, 35, 13, 18, 39 }; string name[SIZE] = {“Mark”, “Rebecca”, “Fred”, “Alfred”,

2. ### MATH

WRITE A SIMPLE BUT A COMPLETE FORTRAN PROGRAM TO COMPUTE THE AVERAGE OF SIX NUMBERS AND DISPLAY THE NUMBERS, SUM AND AVVERAGE. THE PROGRAM SHOULD TERMINATE WHEN ZERO IS ENTERED AS A NUMBER. THE PROGRAM SHOULD BE EDUCATIVE

3. ### statistics

the average number of years a person takes to complete a graduate degree program is 3. the standard deviation is 4 months. Assume the variable is normally distributed. If an individual enrolls in the program, find the probability

4. ### Math

A survey about the student government program at a school finds the following results: 190 students liked the program. 135 students think the program is unnecessary. 220 students plan on running for student government next year.