subject

C# Debugging help// 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 TwoWayStreetusing static System. Console;class DebugTen02{static void Main(){OneWayStreet oak = new OneWayStreet("Oak Avenue", "east");TwoWayStreet elm = new TwoWayStreet("Elm Street", "south");WriteLine("On " + oak. Name + " " + oak. MakeUTurn());WriteLine("On " + oak. Name + " " + oak. MakeUTurn());WriteLine("On " + elm. Name + " " + elm. MakeUTurn());WriteLine("On " + elm. Name + " " + elm. MakeUTurn());}}abstract class Street{protected string name;private string direction;public Street(string name string travelDirection){name = name;direction = direction;}public string Name{get{return Name;}}public abstract string MakeUTurn();}class OneWayStreet : Street{public OneWayStreet(string name, string direction){}public override string MakeUTurn(){string temp = "U Turn is illegal! Was going and still going " + direction;return temp;}}class TwoWayStreet : Street{public TwoWayStreet(string name, string direction) : base(name, direction){}public override string MakeUTurn{string wasGoing = direction;string[] directions = {"north", "south", "east", "west"};string[] oppDirections = {"south", "north", "west", "east"};for(int x = 0; x < directions. Length; ++x){if(direction. Equals(directions[x])){direction = oppDirections[x];x = directions. Length;}}string temp = "U Turn successful. Was going " + wasGoing +". Now going " + direction;return;}}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print.
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What key should you press and hold to select and open multiple files at one time? enter alt control esc
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
You know the right answer?
C# Debugging help// Street is an abstract class// OneWayStreet and TwoWayStreet derive from Street//...
Questions
question
Biology, 30.06.2021 15:30
question
Mathematics, 30.06.2021 15:30
question
Social Studies, 30.06.2021 15:30