Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class hockeypoopoo{
- public static void main(String [] args){
- Scanner input = new Scanner(System.in);
- System.out.println("How many pucks could a puck pick pick if a puck pick could pick pucks?");
- int length = input.nextInt();
- double r, t, w;
- Puck[] puckarray = new Puck[length];
- for(int i = 0; i < length; i++){
- System.out.println("What is the radius of puck "+(i + 1)+" in inches?");
- r = input.nextDouble();
- System.out.println("What is the thickness of puck "+(i + 1)+" in inches?");
- t = input.nextDouble();
- System.out.println("What is the weight of puck "+(i + 1)+" in ounces?");
- w = input.nextDouble();
- System.out.println();
- puckarray[i] = new Puck(r, w, t);
- }
- for(int a = 0; a < length; a++){
- System.out.println("The current weight of puck "+(a + 1)+" is "+puckarray[a].getWeight());
- System.out.println("What is the new weight??");
- puckarray[a].setWeight(input.nextDouble());
- System.out.println("The current thickness of puck "+(a + 1)+"is "+puckarray[a].getThickness());
- System.out.println("What is the new thickness??");
- puckarray[a].setThickness(input.nextDouble());
- System.out.println("The current radius of puck "+(a + 1)+"is "+puckarray[a].getRadius());
- System.out.println("What is the new radius??");
- puckarray[a].setRadius(input.nextDouble());
- System.out.println("The division of puck "+(a + 1)+" is "+puckarray[a].getDivision());
- System.out.println();
- }
- System.out.println();
- System.out.println(puckarray[0]+ " and "+puckarray[1].volume()+" volume and "+puckarray[1].area()+" area");
- System.out.println(puckarray[1] + " and "+puckarray[1].volume()+" volume and "+puckarray[1].area()+" area");
- System.out.println();
- System.out.println("It is "+ puckarray[0].equals(puckarray[1])+" that the two pucks are equal");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement