Is there anything I'm missing, or anything I should add? Do I need to comment non public/private variables, such as the instance of random called, or my main method variables? My teacher is super anal, and explained javadoc for less than 5 seconds. Surely appreciate it.
package gps; import java.util.Random; /** * @author Jimbob * @version 1.0 */ public class GPS { /** * The name assigned to construct */ private String name; /** * Two part double value assigned to construct */ private GpsCoordinates position; Random v1 = new Random(); /** * Constructs a GPS from a GpsCoordinate and a string value. * @param n String name of GPS * @param pos the (x,y) value of GPS */ public GPS ( String n, GpsCoordinates pos ) { name = n; position = pos; } /* * Adds a random value between -2.5 and 2.5 to position */ public void updatePosition() { position.setLatitude( position.getLatitude() - 2.5 + v1.nextInt(6) ); position.setLongitude( position.getLongitude() - 2.5 + v1.nextInt(6) ); } @Override /* * Converts GPS n to a string value * @return string value of GPS n */ public String toString() { return String.format( "%s: %s", name, position ); } } package gps; /** * @author Jimbob * @version 1.0 */ public class GpsApp { public static void main( String[] args ) { GpsCoordinates saltLakeCity = new GpsCoordinates( 40.760671, -111.891122 ); System.out.printf( "Gps coordinates of SLC: %s%n%n", saltLakeCity ); GPS SLC = new GPS( "Garmin", saltLakeCity ); System.out.printf( "myGps: %s%n%n", SLC ); SLC.updatePosition(); System.out.printf( "position update1: %s%n", saltLakeCity ); SLC.updatePosition(); System.out.printf( "position update2: %s%n", saltLakeCity ); SLC.updatePosition(); System.out.printf( "position update3: %s%n", saltLakeCity ); } }