-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (23 loc) · 769 Bytes
/
Copy pathProgram.cs
File metadata and controls
25 lines (23 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
namespace ElevatorConsole
{
class Program
{
static void Main(string[] args)
{
// starting floor. Assume user starts from 1F
int currentFloor = 1;
// enter elevator
Console.WriteLine("Select Floor\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10");
string floor = Console.ReadLine();
Console.WriteLine("Floor: " + floor);
// convert floor to int
int changeFloor = Convert.ToInt32(floor);
// move you up or down x number of floors
currentFloor = changeFloor;
Console.WriteLine(currentFloor);
// leave elevator
Console.WriteLine("Arrived at " + currentFloor + ".Goodbye");
}
}
}