Ok so im completely lost i have never done any kind of c# coding and am trying to learn.
The task I have to do:
Calculate the parking fee for each customer, and put that out together with the hours parked.
There is a maximum parking fee of $20.00.
Calculate and output the average of the parking fees.
Overall Tasks: Read the data file ‘hours.txt’ into an array of data type integer Calculate the parking fee for each customer and output the hours parked and the parking fee.
Calculate the average parking fee Output the average parking fee (formatted to 2 decimal places) for now, declare your array and assign the numbers as shown below.
This is what i have come up with so far. And plaese remember that like i said im very NEW to this and I´m looking for some guidence.
int[] hours;
hours = new int[30];
const decimal HOURLY_RATE = 2.50m;
const decimal MAX_FEE = 20.00m; //Capped at S20.00
decimal parkFee;
decimal parkingCost = HOURLY_RATE;
int[] hoursArray = { 8, 24, 9, 7, 6, 12, 10, 11, 23, 1, 2, 9, 8, 8, 9, 7, 9, 15, 6, 1, 7, 6, 12, 10, 11, 23, 1, 2, 9, 8 };
Console.WriteLine("Hours " + "Parking Fee ");
int total = 0;
double average = 0;
for (int index = 0; index < hours.Length; index++)
if (parkingCost > MAX_FEE)
{
parkFee = parkingCost * MAX_FEE;
Console.WriteLine("Hours " + "Parking Fee ");
}
average = (double)total / hours.Length;
Console.WriteLine("Average = " + average.ToString("N2"));
Console.ReadKey();`