Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class hockeypoopoo{
  4. public static void main(String [] args){
  5.  
  6. Scanner input = new Scanner(System.in);
  7.  
  8. System.out.println("How many pucks could a puck pick pick if a puck pick could pick pucks?");
  9. int length = input.nextInt();
  10.  
  11. double r, t, w;
  12.  
  13. Puck[] puckarray = new Puck[length];
  14.  
  15. for(int i = 0; i < length; i++){
  16. System.out.println("What is the radius of puck "+(i + 1)+" in inches?");
  17. r = input.nextDouble();
  18.  
  19. System.out.println("What is the thickness of puck "+(i + 1)+" in inches?");
  20. t = input.nextDouble();
  21.  
  22. System.out.println("What is the weight of puck "+(i + 1)+" in ounces?");
  23. w = input.nextDouble();
  24.  
  25. System.out.println();
  26.  
  27. puckarray[i] = new Puck(r, w, t);
  28. }
  29. for(int a = 0; a < length; a++){
  30.  
  31. System.out.println("The current weight of puck "+(a + 1)+" is "+puckarray[a].getWeight());
  32. System.out.println("What is the new weight??");
  33. puckarray[a].setWeight(input.nextDouble());
  34.  
  35. System.out.println("The current thickness of puck "+(a + 1)+"is "+puckarray[a].getThickness());
  36. System.out.println("What is the new thickness??");
  37. puckarray[a].setThickness(input.nextDouble());
  38.  
  39. System.out.println("The current radius of puck "+(a + 1)+"is "+puckarray[a].getRadius());
  40. System.out.println("What is the new radius??");
  41. puckarray[a].setRadius(input.nextDouble());
  42.  
  43. System.out.println("The division of puck "+(a + 1)+" is "+puckarray[a].getDivision());
  44.  
  45. System.out.println();
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. }
  54.  
  55. System.out.println();
  56. System.out.println(puckarray[0]+ " and "+puckarray[1].volume()+" volume and "+puckarray[1].area()+" area");
  57. System.out.println(puckarray[1] + " and "+puckarray[1].volume()+" volume and "+puckarray[1].area()+" area");
  58. System.out.println();
  59. System.out.println("It is "+ puckarray[0].equals(puckarray[1])+" that the two pucks are equal");
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement