public class SpaceshipTester
{
public static void main(String[]
args)
{
Spaceship
ent = new Spaceship(10,
2400.5, "Enterprise");
//Testing get methods
System.out.println(ent.getHp());
System.out.println(ent.getSize());
System.out.println(ent.getName());
//Testing set methods
System.out.println(ent); //calling
toString()
ent.setHp(17);
System.out.println(ent);
ent.setHp(-3); //does nothing
System.out.println(ent);
ent.setSize(4444.4);
System.out.println(ent.getSize());
ent.setSize(-2345.2); //does nothing
System.out.println(ent.getSize());
ent.setName("Millenium
Falcon");
System.out.println(ent);
ent.setName(""); //does nothing
System.out.println(ent);
}
}
|