I am
learning arrays and have a program that needs some help. What I am trying to do is enter the miles of a trip then get a ticket price. For example 0-99 miles would be $25, 100-299...$40,...300-499,...$55 farther than 500 miles is $70. Here is what I have any pointers would be appericated. I know I need to account for all the miles 0-500 Thanks
using System;
public class Miles
{
public static string GetMiles()
{
string Miles;
Console.WriteLine("Enter miles ");
Miles = Console.ReadLine();
return Miles;
}
public static void Main()
{
string Miles;
Miles = GetMiles();
int[] distanceMiles = {0, 100, 300, 500};
double[] price = {25.00, 40.00, 55.00, 70.00};
double customerMiles;
int sub = 4;
while(sub >= 0 && Convert.ToInt32(Miles) < distanceMiles[sub])--sub;
customerMiles = price[sub];
}
}