![]() Public method getLocation that returns a String containing the current location. The method should then return the current location as a String. DOWN, LEFT, and IN would pass -1, while UP, RIGHT and OUT would pass +1. Public method move with a String parameter specifying the direction, and that uses the direction value using if.else if statements to check the direction parameter against the class constants UP, DOWN, etc., changing the value of the location x, y or z fields by calling changeX, changeY or changeZ. Six private constant String class variables called UP, DOWN, LEFT, RIGHT, IN, and OUT set to U, D, L, R, I, and O respectively.Ī default constructor that creates the location class field object. ![]() Note: This class must ONLY be called and accessed from the Guide class defined below.Ĭreate a class called Guide with the following specifications: Public method getLocation that returns a String displaying the values of x, y and z in the format of (x, y, z). Public methods changeX, changeY and changeZ with int parameter that increments the appropriate field by the parameter value. Private int fields x, y and z, initialized to zero.Īn overloaded constructor that sets all three field values.Īccessors for all three fields, creating read-only properties. Using jGrasp, create a project for Lab 4, and complete the following tasks.Ĭreate a class called Location with the following specifications: This project has two parts: Part A and Part B.
0 Comments
Leave a Reply. |