Computers and Technology

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;}}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:00, kamilahmcneil3969
What are the most likely causes of conflict at the meeting? check all that apply.
Answers: 1
image
Computers and Technology, 23.06.2019 00:30, vane3152
If joey was single and his taxable income was $9,500, how much would he pay in taxes each year?
Answers: 1
image
Computers and Technology, 24.06.2019 05:30, lexie2751
How do i get rid of my member ship for
Answers: 2
image
Computers and Technology, 24.06.2019 07:00, Dkhaurithompson
Selective is defined as paying attention to messages that are consistent with one’s attitudes and beliefs and ignoring messages that are inconsistent.
Answers: 1
Do you know the correct answer?
C# Debugging help// Street is an abstract class// OneWayStreet and TwoWayStreet derive from Street//...

Questions in other subjects:

Konu
Mathematics, 10.12.2020 09:50