Page 1 of 1

Re: used car value calculator

Posted: Sun Aug 19, 2007 2:09 pm
by Yam
[quote author=Yam link=1187277225/0#0 date=1187277225]code:
`Used car calculator
`this is not the actual price value of your car
`it`s just to show you how you can do it

object myform1 as form
   Caption = "Used Cars Value"
   Width = 400
   Height = 225
`    Center `do not work
   Color = 16760962
  object label1 as label
       Caption = "Year Of The Car    = "
       Left = 57
       Top = 24
       Width = 112
       Transparent = 1
  end object
   object label2 as label
       Caption = "   Today  Year          = "
       Left = 49
       Top = 48
       Width = 120
       Transparent = 1
   end object
   object label3 as label
       Caption = "Price you payed   = "
       Left = 57
       Top = 72
       Width = 104
       Transparent = 1
  end object
   object edit1 as edit
       Text = ""
       Left = 175
       Top = 20
       Width = 89
   end object
   object edit2 as edit
       Text = ""
       Left = 175
       Top = 46
       Width = 89
       TabOrder = 1
   end object
   object edit3 as edit
       Text = ""
       Left = 175
       Top = 70
       Width = 89
       TabOrder = 2
     end object
   object edit4 as edit
       Text = ""
       Left = 175
       Top = 100
       Width = 105
       TabOrder = 3
   end object
   object button1 as button
       Caption = "Actuel  Value  = "
       Left = 56
       Top = 100
       Width = 99
       TabOrder = 4
       onclick=butt
   end object
end object

myform1.showmodal

Sub butt()
Dim am as double
Dim pm as double
Dim a as double
Dim p  as double

a = val(edit1.text)`year build
am = val(edit2.text)`actuel year
p = val(edit3.text) `amout payed for
pm = p
if a=am then:pm=p:edit4.text=str$(pm):end if
am=am-1
pm=pm*(75/100) ` first year                  `.75 do not work had to write it like that 75/100
if a=am then:edit4.text=str$(pm):end if
am=am-1
pm=pm*(85/100) ` second year
if a=am then:edit4.text=str$(pm):end if
am=am-1
pm=pm*(90/100) ` third year
if a=am then:edit4.text=str$(pm):end if
WHILE am>a
am=am-1
pm=pm*(90/100) ` all the rest
edit4.text=str$(pm)
wend

end sub[/quote]