Guest User

Untitled

a guest
Apr 21st, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. static double cylinder (String which){
  2. double r = num();
  3. double h = num();
  4. h = num();
  5. if(which.equals("volume")){
  6. return (h × Math.PI × r * r);
  7. }
  8. else if(which.equals("surface")){
  9. return 2 × r × Math.PI × h + 2 × Math.PI × r * r;
  10. }
  11. else{
  12. System.out.println("You need to enter 'volume' or 'surface', input not recognized.");
  13. return -1.0
  14. }
  15. }
Add Comment
Please, Sign In to add comment