Question: I need to debug this exercise in C# Please. I ran my corrections and got the following errors. Please make sure these errors are addressed
I need to debug this exercise in C# Please. I ran my corrections and got the following errors. Please make sure these errors are addressed as well. Code and errors are below. Thanks!
Starting Code:
Street is an abstract class
OneWayStreet and TwoWayStreet derive from Street
On a OneWayStreet, it is illegal to make a U turn
On a TwoWayStreet, a U Turn reverses the travelling direction
Main program creates two Street child objects one OneWay and one TwoWay
and demonstrates what happens when you make a U Turn
on a OneWayStreet and a TwoWayStreet
using static System.Console;
class DebugTen
static void Main
OneWayStreet oak new OneWayStreetOak Avenue", "east";
TwoWayStreet elm new TwoWayStreetElm Street", "south";
WriteLineOn oak.Name oak.MakeUTurn;
WriteLineOn oak.Name oak.MakeUTurn;
WriteLineOn elm.Name elm.MakeUTurn;
WriteLineOn elm.Name elm.MakeUTurn;
public abstract class Street
protected string name;
private string direction;
public Streetstring name string travelDirection
name name;
direction direction;
public string Name
get
return Name;
public abstract string MakeUTurn;
class OneWayStreet : Street
public OneWayStreetstring name, string direction
public override string MakeUTurn
strin temp U Turn is illegal! Was going and still going direction;
return temp;
class TwoWayStreet : Street
public TwoWayStreetstring name, string direction : basename direction
public override string MakeUTurn
string wasGoing direction;
string directions north "south", "east", "west";
string oppDirections south "north", "west", "east";
forint x ; x directions.Length; x
ifdirectionEqualsdirectionsx
direction oppDirectionsx;
x directions.Length;
string temp U Turn successful. Was going wasGoing
Now going direction;
return;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
