Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static double cylinder (String which){
- double r = num();
- double h = num();
- h = num();
- if(which.equals("volume")){
- return (h × Math.PI × r * r);
- }
- else if(which.equals("surface")){
- return 2 × r × Math.PI × h + 2 × Math.PI × r * r;
- }
- else{
- System.out.println("You need to enter 'volume' or 'surface', input not recognized.");
- return -1.0
- }
- }
Add Comment
Please, Sign In to add comment