public void releaseVehicle() { // record transaction, update the counters for the dispensed liters, and remove car from pump Receipt receipt = new Receipt(currentVehicle, this._totalLitresDispensed, this._id); PetrolStation.storeReceipts(receipt); PetrolStation.servicedVehiclesCounter++; PetrolStation.updateLitersCounters(currentVehicle, this._totalLitresDispensed); currentVehicle = null; }
static void Main(string[] args) { PetrolStation.createStation(); Timer timer = new Timer(); timer.Interval = 1000; timer.AutoReset = true; // every 2 seconds update console view/display timer.Elapsed += RunProgramLoop; timer.Enabled = true; timer.Start(); Console.ReadLine(); }
// static void RunProgramLoop(object sender, ElapsedEventArgs e) { Console.Clear(); Console.WriteLine(); Display.showCounters(); Console.WriteLine(); Console.WriteLine(); Display.showVehicles(); Console.WriteLine(); Console.WriteLine(); Display.showPumps(); Console.WriteLine(); Console.WriteLine(); Display.showReceipts(); PetrolStation.assignVehicleToPump(); }