I am supposed to write a Tester to get the current volume of a balloon that starts with a radius of 0 after it is inflated.
This is the balloon:
public class Balloon { private double savedRadius;//instance variable /**constructor!! Constructs a balloon with a radius */ public Balloon(double radius) { savedRadius = radius; } //doubles the radius of the balloon public void inflate(double radius) { savedRadius = savedRadius + radius; //returning total, accumilating } /** Gets the volume*/ public double getVolume() { double volume = (1.33 * 3.14 * savedRadius * savedRadius * savedRadius); return volume; } }
This is what I have so far for the BalloonTester. I have tried multiple different things and I keep getting errors, I am at my wits end.
public class BalloonTester { /** */ public static void main(String[] args) { Balloon newBalloon = new Balloon(0); System.out.println("Current volume of the ballon: "+newBalloon.getVolume()); } }
I am not asking for it to be done for me, I just need to know where to start as this is getting on my nerves.