Created
June 13, 2014 17:05
-
-
Save nshiba/666d6c1ac3703afd84a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ex5; | |
import java.util.Scanner; | |
public class CalcAreaOfCircle { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
// TODO 自動生成されたメソッド・スタブ | |
CalcAreaOfCircle c = new CalcAreaOfCircle(); | |
while (true) { | |
Scanner s = new Scanner(System.in);//数字入力の準備 | |
int radius = s.nextInt(); | |
c.calc(radius); | |
} | |
} | |
public void calc(int radius) {//面積を計算するメソッド | |
double answer = radius * radius * Math.PI; | |
System.out.println(answer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment