Advertisement
gnamp

fuel consumption small basic

Aug 24th, 2012
2,530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. GraphicsWindow.Title = "How expensive will your trip be?"
  2. GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 2
  3. GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width) / 2
  4. colour = GraphicsWindow.GetRandomColor()
  5. colour2 = GraphicsWindow.GetRandomColor()
  6. GraphicsWindow.BackgroundColor = colour
  7. GraphicsWindow.BrushColor = colour2
  8. GraphicsWindow.DrawText(0, 24, "Enter your total journey's distance in kilometers:")
  9. Distance1 = Controls.AddTextBox(295, 20)
  10. GraphicsWindow.DrawText(82, 46, "Enter your fuel consumption (KPL):")
  11. Consumption1 = Controls.AddTextBox(295, 42)
  12. GraphicsWindow.DrawText(103, 68, "Enter the price per liter for fuel:")
  13. Price1 = Controls.AddTextBox(295, 64)
  14. Controls.AddButton("Calculate", 190, 150)
  15. Controls.ButtonClicked = Button
  16. Sub Button
  17.   GraphicsWindow.DrawText(0, 90, "It will cost you $")
  18.   Distance = Controls.GetTextBoxText(Distance1)
  19.   Consumption = Controls.GetTextBoxText(Consumption1)
  20.   Price = Controls.GetTextBoxText(Price1)
  21.   Total = Distance*Consumption*Price/100
  22.   GraphicsWindow.DrawText(100, 90, Total)
  23. EndSub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement