Add code examples, and documentation
This commit is contained in:
41
patterns/state/CarState/Program.cs
Normal file
41
patterns/state/CarState/Program.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
#region
|
||||
|
||||
using System;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace CarState;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
var car = new Car();
|
||||
|
||||
string input;
|
||||
bool keepRunning = true;
|
||||
|
||||
Console.WriteLine("Welcome to the Driving Simulater");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine(" turn-clockwise -Turns the car's key clockwise");
|
||||
Console.WriteLine(
|
||||
" turn-counter -Turns the car's key counter clockwise"
|
||||
);
|
||||
Console.WriteLine(" gas -Presses the gas pedal");
|
||||
Console.WriteLine(" brake -Presses the brake pedal");
|
||||
Console.WriteLine(" exit -Exits the simulator");
|
||||
Console.WriteLine();
|
||||
|
||||
do
|
||||
{
|
||||
Console.Write("> ");
|
||||
input = Console.ReadLine();
|
||||
Console.WriteLine();
|
||||
keepRunning = car.HandleInput(input);
|
||||
} while (keepRunning);
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("goodbye");
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user