End If
Event: Clicking Squeeze / Stop Squeezing Nozzle Button
If Button Says Squeeze then
Button says Stop Squeezing
Button Nozzle is disabled
Timer is enabled
On Console State of Pump = In Use
If Button says Stop Squeezing then
Button says Squeeze
Button Nozzle is enabled
Timer is disabled
End If
Console Operation
Event: Clicking Zero Petrol Dispensed Button
On Pump, Number of Litres and Amount to Pay are set to 0
On Console, Number of Litres and Amount to Pay are set to 0
Pump = Ready for Use
On Pump, Squeeze Nozzle Button is enabled
Event: Clicking New Price per Litre Button
Dialog appears where the user enters the new price
On OK Button clicked then
Price per litre set to entered price
PerLitre variable set to price entered
Event: Click New Day Button
Message box appears awaiting confirmation
If Yes is clicked then
On Pump, number of litres and amount to pay set to 0
On Console, number of litres and amount to pay set to 0
On Console, NoOfCustomers, TotalPetrol and TotalTakings variables set to 0
Message box appears confirming the actions have taken place
Else: Do nothing
End If
Simulating The Seven Segment LCD Display
Event: Timer Tick while the pump is being squeezed
Litres dispensed variable + 0.1
On Console number of litres dispensed = variable
Amount to pay = number of litres × price per litre
On Console the amount to pay = variable
With the Number of Litre
Loop from the 1st digit to the last
Take the digit and change the LCD digit to this digit
With the Amount to pay
Loop from the 1st digit to the last
Take the digit and change the LCD digit to this digit
If number of litres ≥ 99.9 then
Timer is disabled
Squeeze button is disabled
Message box telling user tank is full
End If
Event: New Price per Litre changed
With the Price per Litre
Loop from the 1st digit to the last
Take the digit and change the LCD digit to this digit
Production Of Daily Totals
Event: Calculating daily totals when pump is replaced
On Replace Nozzle Button clicked then
Number of litres dispensed added to TotalPetrol variable
Amount to pay added to TotalPetrol variable
Number of customer’s variable increases by 1
Security
To ensure that the system is secure, when the program is run, the console will remain hidden. A button will allow the user to enter the password in a dialog window. If the credentials are entered incorrectly a message box will appear saying this and allow the user to enter them again. If they are correct the button disappears and the console is displayed.
Implementation
User Interface
Main Form- Console Hidden
When the program is started, the homepage is shown. This allows the customer to use the pump and Peter to use the console. They appear on the same form that has been split in 2. The pump is automatically shown and the console is hidden.
Main Form- Console Unlocked
The console cannot be used without clicking the Activate Console button and entering the password to make the console visible. Then Peter can use the controls on the console that perform administrative tasks, such as changing the price per litre and viewing the daily totals.
Login Dialog
The login dialog is a simple form where the password to show the console can be entered. The characters entered are hidden with the ‘*’ symbol for security. When OK is pressed, the entered password is compared with the correct password and if they are the same the console is unlocked. Otherwise the console remains hidden.
Price Per Litre Dialog
This form has a similar layout to the login dialog. It allows Peter to enter a new price per litre in the format shown and when OK is pressed
Litres Sold
From the console, Peter can see the number of litres sold during the last day, in the form of a message box.
Total Takings
From the console, Peter can see the amount of money taken during the last day, in the form of a message box.
New Day
On the console, Peter has the option to start a new day, which will have a confirmation dialog. If he confirms, then the totals will be reset to 0 and the number of customers.
Testing
Test Data
Testing Screenshots
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Code
Alex Sheppard Computing AS