/*
C#: The Complete Reference
by Herbert Schildt
Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Simulate a conveyor belt
using System;
class ConveyorControl {
// enumerate the conveyor commands
public enum action { start, stop, forward, reverse };
public void conveyor(action com) {
switch(com) {
case action.start:
Console.WriteLine("Starting conveyor.");
break;
case action.stop:
Console.WriteLine("Stopping conveyor.");
break;
case action.forward:
Console.WriteLine("Moving forward.");
break;
case action.reverse:
Console.WriteLine("Moving backward.");
break;
}
}
}
public class ConveyorDemo {
public static void Main() {
ConveyorControl c = new ConveyorControl();
c.conveyor(ConveyorControl.action.start);
c.conveyor(ConveyorControl.action.forward);
c.conveyor(ConveyorControl.action.reverse);
c.conveyor(ConveyorControl.action.stop);
}
}