Jump to content

Fuel consumption/range


Aceguy
 Share

Recommended Posts

was bored one day and came up with this.

#include<EditConstants.au3>
Global $d1,$ppl
Opt("GUIOnEventMode", 1)

$MPG_gui = GUICreate("MPG", 239, 119, 493, 284)

$MPG = GUICtrlCreateInput("MPG", 8, 16, 81, 21)
GUICtrlSetOnEvent(-1, "mpg")
$PPL = GUICtrlCreateInput("Pence per Liter", 8, 40, 81, 21)
GUICtrlSetOnEvent(-1,"pence")
$dist = GUICtrlCreateInput("Distance", 8, 64, 81, 21)
GUICtrlSetOnEvent(-1, "dist")
$money = GUICtrlCreateInput("money", 18, 88, 71, 21)
GUICtrlSetOnEvent(-1,"mon")
$Label1 = GUICtrlCreateLabel("", 96, 16, 126, 17)
$Label2 = GUICtrlCreateLabel("", 96, 40, 126, 17)
$Label3 = GUICtrlCreateLabel("", 96, 64, 126, 17)
$Label4 = GUICtrlCreateLabel("", 96, 88, 126, 17)
$pnd=GUICtrlCreateLabel("£",8,91,10,15)
GUISetState(@SW_SHOW)


While 1
    Sleep(50)
WEnd

Func mpg()
    $mpl = GUICtrlRead($MPG)
    $d1 = round($mpl / 4.545, 2)
    GUICtrlSetData($Label1, $d1 & " Miles per litre")
    if GUICtrlRead($dist)<>"Distance" Then
        dist()
    elseif guictrlread($money)<>"money" Then
        mon()
    elseif guictrlread($ppl)<>"Pence per Liter" Then
    $q=$d1/GUICtrlRead($ppl)
    GUICtrlSetData($Label2,"£"&round($q,2)& " p for 1 mile")   
        EndIf
EndFunc   ;==>mpg

Func dist()
    $res1 = GUICtrlRead($dist) / $d1 * GUICtrlRead($PPL)
    $res2 = Round($res1 / 100, 2)
    GUICtrlSetData($Label3, "£" & $res2)
EndFunc   ;==>dist

Func mon()
    $ct=GUICtrlRead($money)
    
    $d=(($ct*100)/GUICtrlRead($ppl))*$d1
    
    ConsoleWrite($d&@lf)
    
    GUICtrlSetData($Label4,Round($d,2)&" Miles")
EndFunc

Func pence()
    $q=$d1/GUICtrlRead($ppl)
    GUICtrlSetData($Label2,"£"&round($q,2)& " p for 1 mile")
    mpg()
    dist()
    mon()
EndFunc
Link to comment
Share on other sites

Interesting, but I prefer Km/l

My beetle, 1300cc, is making 15,5 Km/l :mellow:

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...