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 road>. Assuming the road = Mission Blvd, this would be Turn right onto Mission Blvd

for left, return Turn left onto road>

for u-turn, return Make a U-turn, when possible (ignores value of road)

for anything else, return Invalid direction : 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!