Pl help with my class assingment
I messed up with my class assignment. Pl help me i did some so far.
And file ShipTest
// public class Ship
private String name;
private double speed;
public String getName()
public double getSpeed()
public void setName(String newName)
name = newName;
public void setSpeed(double s)
if (s >= 0)
speed = s;
public double timeToCrossEnglishChannel(double s)
return speed * 2;
So in File ship how to: Declare a public method called timeToCrossEnglishChannel.
public class ShipTest
public static void main(String args)
Ship myShip = new Ship();
It takes no parameter and returns the number of hours it takes to cross the channel. The return value is of type double.
and in File Shiptest how to: Create an instance of type Ship. Call the variable of type Ship paddleStreamer.
The name of the paddleStreamer is Rob Roy and the speed is 6 knots. Use this information to assign the fields.
Re: Pl help with my class assingment
You forgot to use code tags.
What's Wrong With My Code?
The indentation is incorrect.
You did not ask a question.
Please edit your post and use code tags on the code, and fix the indentation so it is easy to read. There are instructions on how to do so in the forum rules.