> Java programming question involving objects and classes.?

Java programming question involving objects and classes.?

Posted at: 2014-12-18 
public class WindSpeed {

// variables

private double kilometerPerHour;

// constructors

public WindSpeed(double kph) {

this.kilometerPerHour = kph;

}

// functions

public boolean isOrcan() {

if (kilometerPerHour > 120) return true;

else return false;

}



public boolean isCalm() {

if (kilometerPerHour < 2) return false;

else return false;

}

public double getKilometerPerHour() {

return kilometerPerHour;

}

public double getKnots() {

return kilometerPerHour * 0.539;

}

public int getBeaufort() {

int answer = (int)java.lang.Math.round((kilometerPerH... * 2/3);

if (answer > 12) return 12;

else return answer;

}

public static void main(String[] args) {

// demo of WindSpeed

WindSpeed speed = new WindSpeed(34.5);

System.out.println(speed.isOrcan() + " " +

speed.isCalm() + " " +

speed.getKnots() + " " +

speed.getBeaufort());

}

}

Really confused, am I supposed to be editing the skeleton?

Another measure for wind speed is the Beaufort scale consisting of integer numbers from 1 to 12.

1.Design and implement a Java class, for creating wind speeds. Implement a constructor to create wind speed for a given velocity in kilometers per hour.

2.The class must contain methods for getting the speed as knots or on the Beaufort scale. Furthermore, it must be possible to check whether the wind is calm or a European windstorm (Orcan).

Wind speeds less than 2 km/h are calm. More than 120 km/h is a European windstorm. A nautic mile is 1,852 Kilometer. The Beaufort scale is defined by B = (v/3.01)2/3, with v as the wind velocity in km/h. The Beaufort value B is rounded to the nearest integer. There are no Beaufort values larger than 12.

3.Write a class WindSpeedTester that takes wind speed as from user. Creates a WindSpeed object and sets the value of windSpeed through constructor. Prints the different windstorm speeds by calling the methods of WinfStorm class.

The skeleton for the code is :

public class WindSpeed {

private double kilometerPerHour = 0.0;

public WindSpeed(double kilometerPerHour) {

}

public boolean IsOrcan() {

}

public boolean isCalm() {

}

public double getKilometerPerHour() {

}

public double getKnots() {

}

public int getBeaufort() {

}

}