average is incorrect

nickkeith707

New member
Joined
May 24, 2017
Messages
1
Programming Experience
Beginner
Hello,

I am working on a grade book program for Plural Sight assignment. For some reason my program is saying my average is incorrect. I have looked and re-did the code a couple times and still it bombs out. Is anyone able to see what I may be doing wrong? The program says the average should be 115. but Average should be 85.1666666666667.

[TestMethod]
public void ComputestAverageGrade()
{
Gradebook book = new Gradebook();
book.AddGrade(91);
book.AddGrade(89.5f);
book.AddGrade(75);
GradeStatistics results = book.ComputeStatistics();
Assert.AreEqual(85.16, results.AverageGrade, 0.01);
}



thank you ahead of time :tears_of_joy:
 
Hello,

I am working on a grade book program for Plural Sight assignment. For some reason my program is saying my average is incorrect. I have looked and re-did the code a couple times and still it bombs out. Is anyone able to see what I may be doing wrong? The program says the average should be 115. but Average should be 85.1666666666667.

[TestMethod]
public void ComputestAverageGrade()
{
Gradebook book = new Gradebook();
book.AddGrade(91);
book.AddGrade(89.5f);
book.AddGrade(75);
GradeStatistics results = book.ComputeStatistics();
Assert.AreEqual(85.16, results.AverageGrade, 0.01);
}



thank you ahead of time :tears_of_joy:

Your 'book.AddGrade(89.5f)' is a float. Is that how that is supposed to be or it just for that one value?

How many arguments can your GradeStatistics result take?

Show us some more of your code and please do use the
C#:
 tags (its a button that says C#, click it and add your code).
 
Hello,

I am working on a grade book program for Plural Sight assignment. For some reason my program is saying my average is incorrect. I have looked and re-did the code a couple times and still it bombs out. Is anyone able to see what I may be doing wrong? The program says the average should be 115. but Average should be 85.1666666666667.

[TestMethod]
public void ComputestAverageGrade()
{
Gradebook book = new Gradebook();
book.AddGrade(91);
book.AddGrade(89.5f);
book.AddGrade(75);
GradeStatistics results = book.ComputeStatistics();
Assert.AreEqual(85.16, results.AverageGrade, 0.01);
}



thank you ahead of time :tears_of_joy:
There's a lot about this we don't know about, for example the Gradebook class, specifically the ComputerStatistics function where the computation occurs.
 
Back
Top Bottom