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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started