Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Declaration Station
- Dim CostPerAnnum As Decimal
- Dim MPG As Decimal 'Miles Per Gallon
- Dim MPA As Decimal 'Miles Per Annum
- Dim POP As Decimal 'Price of Fuel
- Dim POD As Decimal 'Price of Diesel
- Dim MPL As Decimal 'Miles Per Litre
- Dim LPA As Decimal 'Litres Per Annum
- Dim Car(10) As Decimal
- Dim MenuChoice As Integer
- Dim i As Integer = 0
- Menu: Do While i < 11
- Console.WriteLine("Press 1 to enter a vehicles details")
- Console.WriteLine("Press 2 to see which is cheaper to run")
- MenuChoice = Console.ReadLine
- *case statement here*
- VehicleAdding: Car(i) = i + 1
- Console.WriteLine("Press 1 to add petrol details")
- Console.WriteLine("Press 1 to add diesel details")
- *case statement here*
- PetrolCars: MPG = Console.ReadLine
- MPL = MPG * 0.219969248 'Converting miles per gallon into miles per litre
- LPA = MPA / MPL 'Amount of litres used per year = MilesPerLitre/MilesPerAnnum
- Car(i) = POP * LPA 'PricePerAnnum (in pence) = PriceOfFuel x LitresUsedPerYear
- Car(i) = Car(i) / 100 'PricePerAnnum converted into pounds
- Diesel: MPL = MPG * 0.219969248 'Converting miles per gallon into miles per litre
- LPA = MPA / MPL 'Amount of litres used per year = MilesPerLitre/MilesPerAnnum
- Car(i) = POD * LPA 'PricePerAnnum (in pence) = PriceOfFuel x LitresUsedPerYear
- Car(i) = Car(i) / 100 'PricePerAnnum converted into pounds
- The compare bit:
- Dim Min As Decimal
- Dim i_min = LBound(Car)
- Dim i_max = UBound(Car)
- For i = i_min To i_max
- If Car(i) < Min Then Min = Car(i)
- Next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement