I'm absolutely stuck so I would appreciate some guidance into how I can do this.
First off, here is my code so far:
int i;
int x = 0;
int b = 0;
Console.Write("\nHow many stocks to enter price for:\t"); // enter size of array
int size = int.Parse(Console.ReadLine());
double[] arr = new double[size]; // size of array
// Accepting value from user
for (i = 0; i < size; i++)
{
Console.Write("\nEnter price for stock #{0}: \t", ++x);
//Storing value in an array
arr[i] = Convert.ToDouble(Console.ReadLine());
}
Console.WriteLine("\n\n");
//Printing the value on console
for (i = 0; i < size; i++)
{
Console.WriteLine("Average Price: " + arr.Average() + " out of {0} stocks", x);
Console.WriteLine("Minimum Price: " + arr.Min());
Console.WriteLine("Number of stocks priced between 1.5-35: " + b);
}
Console.ReadLine();
Sorry, I'm not very sure on how to add the colors.
Anyway, I am stuck on displaying the number of stocks priced between 1.5 and 35. Shown in this line here: Console.WriteLine("Number of stocks priced between 1.5-35: "+ b);
Basically, it asks for the number of stocks to enter the price for. This will determine the size of the array. Then the user will enter the prices for the stocks x many times as they set it in the beginning. Thus calculating the Average price of a stock, the minimum price then (what i'm stuck on) the number of stocks priced between 1.5 and 35.
Also, i'm sure I could figure this out myself, but for some reason it is displaying the results 2 times each. Not too sure about that as well.
Any help would be appreciated as I've been stuck on this for too damn long.