Advertisement
waytoofoxy

Untitled

Mar 29th, 2015
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Problem1 {
  3. public static void main(String args[]){
  4. Scanner input = new Scanner(System.in);
  5. double volume;
  6. double radius;
  7. double height;
  8. double cost;
  9. boolean done = false;
  10. String donecheck;
  11. while(done=false){
  12. System.out.println("Input the Volume");
  13. volume = input.nextDouble();
  14. System.out.println("Input the radius");
  15. radius = input.nextDouble();
  16. height = volume / (Math.PI*radius*radius);
  17. cost = 2*Math.PI* radius*(radius + height);
  18. System.out.println("Height is " + height);
  19. System.out.println("Cost is $" + cost);
  20. System.out.println("Type y if you wish to continue");
  21. donecheck = input.next();
  22. if(donecheck == "y"){
  23. done = false;
  24. }else{
  25. done = true;
  26. }
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement