Older Version
Newer Version
cogburn
May 23, 2012
**Half-Life** This program might prove useful to chemistry or physics teachers or students. [[code format="lb"]] 'Halflife 2.0 'by Scott Ausbrooks 'May 2012 'This program calculates the amount of radioactive 'material remaining after "x" number of halflives nomainwin WindowWidth = 900 WindowHeight = 500 button #1.button1,"Calculate",[action], UL, 10,30,120,50 button #1.button2,"Clear",[clear], LL, 10,20,120,50 button #1.button3,"Exit",[quit],LR,120,60,120,50 textbox #1.textbox0, 650, 30, 180, 60'mass textbox #1.textbox1, 650, 130, 180, 60 'halflife textbox #1.textbox2, 650, 230, 180, 60'decaytime textbox #1.textbox3, 310, 320, 180, 100'result statictext #1.originalmass, "Original Mass",550,30,100,50 statictext #1.decaytime, "Decay Time",550,230,100,50 statictext #1.halflife, "Half-Life",550,150,100,25 statictext #1.result, "Result",365,430,100,25 open "Radioactive Isotope Remaining" for window as #1 print #1, "font times_new_roman 18 BOLD" print #1.textbox0, "!setfocus" print #1, "trapclose [quit]" wait [action] print #1.textbox1,"!contents?" input #1.textbox1, halflife$ print #1.textbox2,"!contents?" input #1.textbox2, decaytime$ print #1.textbox0,"!contents?" input #1.textbox0, mass$ numhalflife = val(decaytime$)/val(halflife$) newmass = val(mass$) * (.5^numhalflife) print #1.textbox3, "!font times_new_roman 18 bold" print #1.textbox3, newmass wait [clear] print #1.textbox0, "" print #1.textbox1, "" print #1.textbox2, "" print #1.textbox3, "" print #1.textbox0, "!setfocus" wait [quit] confirm "Really quit?";answer$ if answer$ = "no" then wait close #1:end [[code]]