Question: In Java, define classes Step and Directions that satisfy the following properties. All instance variables (in other words, fields) should be private or protected. Step
In Java, define classes Step and Directions that satisfy the following properties. All instance variables (in other words, fields) should be private or protected.
Step includes:
a direction : can be right, left or u-turn
a road, like: Mission Blvd or Decoto Rd
a constructor to initialize these values
a toString() method that returns text for the step depending on the direction
for right, return Turn right onto
for left, return Turn left onto
for u-turn, return Make a U-turn, when possible (ignores value of road)
for anything else, return Invalid direction :
Directions includes: a list of the Step's for this Directions a constructor to initialize this list a method to add a Step to the Directions a method to display the steps to the console output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
