double.MinValue is -1 divided by 10^300 or so.
Line 17 of your code is OK, but in line 26 and 29 you are substracting this value two times(x 10) from your total. What you have to do is after every input of a grade check if that input is smaller than min. If it is assign it to min. Make your total, don't substract min here! After 10 times min will now contain the smallest input.
Put lines 29 and 30 outside the while loop.
Succes!
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
If I understand the question correctly you need to remove the lowest value from the ten inputs and then average the remaining nine values.
Currently you are not doing that as the min is never changed from Double.MinValue (-1.7976931348623157E+308 ).
I think you need to add all the grades together and watch for the lowest grade, remove that from the total, then calculate the avereage by dividing by nine. Somthing like this:
double min = double.MaxValue;
//...
//...
while (gradeCounter <= 10) // while loop
{
Console.Write("Enter grade: ");
grade = Convert.ToDouble(Console.ReadLine());
if (grade < min) min = grade;
total += grade;
gradeCounter = gradeCounter + 1;
}
average = (total - min) / 9;
Console.WriteLine("\nAfter the last score is dropped, the class average is {0}", average);
privatevoid
Junior Poster in Training
92 posts since Feb 2009
Reputation Points: 34
Solved Threads: 21
You are right privatevoid, for a min-function you have to test on the maxvalue of course! Thanks for reminding.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
We're all learning, and we're all here to help each other.
Welcome to Daniweb, as long as you show a willingness to learn and make an effort for yourself we will always be happy to help you :)
Ryshad
Nearly a Posting Virtuoso
1,307 posts since Aug 2009
Reputation Points: 512
Solved Threads: 246