Advertisement
rebeccalyndescott

Untitled

Feb 18th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1.     int initialDegrees;
  2.     int heading;
  3.  
  4.  
  5.     /**
  6.      * Constructor for objects of class CompassHeading
  7.      */
  8.     public CompassHeading(int initialDegrees)
  9.     {
  10.         // initialise instance variables
  11.         if (initialDegrees<0 || initialDegrees>360) {
  12.             throw new IllegalArgumentException("heading out of bounds");
  13.         }
  14.         else {
  15.             heading = initialDegrees;
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement