Advertisement
Guest User

Untitled

a guest
Jul 27th, 2014
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. 'Declaration Station
  2. Dim CostPerAnnum As Decimal
  3. Dim MPG As Decimal 'Miles Per Gallon
  4. Dim MPA As Decimal 'Miles Per Annum
  5. Dim POP As Decimal 'Price of Fuel
  6. Dim POD As Decimal 'Price of Diesel
  7. Dim MPL As Decimal 'Miles Per Litre
  8. Dim LPA As Decimal 'Litres Per Annum
  9. Dim Car(10) As Decimal
  10. Dim MenuChoice As Integer
  11. Dim i As Integer = 0
  12.  
  13. Menu: Do While i < 11
  14. Console.WriteLine("Press 1 to enter a vehicles details")
  15. Console.WriteLine("Press 2 to see which is cheaper to run")
  16. MenuChoice = Console.ReadLine
  17. *case statement here*
  18. VehicleAdding: Car(i) = i + 1
  19. Console.WriteLine("Press 1 to add petrol details")
  20. Console.WriteLine("Press 1 to add diesel details")
  21. *case statement here*
  22. PetrolCars: MPG = Console.ReadLine
  23. MPL = MPG * 0.219969248 'Converting miles per gallon into miles per litre
  24. LPA = MPA / MPL 'Amount of litres used per year = MilesPerLitre/MilesPerAnnum
  25. Car(i) = POP * LPA 'PricePerAnnum (in pence) = PriceOfFuel x LitresUsedPerYear
  26. Car(i) = Car(i) / 100 'PricePerAnnum converted into pounds
  27. Diesel: MPL = MPG * 0.219969248 'Converting miles per gallon into miles per litre
  28. LPA = MPA / MPL 'Amount of litres used per year = MilesPerLitre/MilesPerAnnum
  29. Car(i) = POD * LPA 'PricePerAnnum (in pence) = PriceOfFuel x LitresUsedPerYear
  30. Car(i) = Car(i) / 100 'PricePerAnnum converted into pounds
  31.  
  32. The compare bit:
  33. Dim Min As Decimal
  34. Dim i_min = LBound(Car)
  35. Dim i_max = UBound(Car)
  36. For i = i_min To i_max
  37. If Car(i) < Min Then Min = Car(i)
  38. Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement