This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Getting the average to display Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Getting the average to display" Watch "Getting the average to display" New topic
Author

Getting the average to display

mike statham
Greenhorn

Joined: Feb 24, 2012
Posts: 16
I need Someone to help me or show me what I need to do for the average to print out correctly

output is:
Connie has an average grade of 85.33 You will receive a B in this class.
James has an average grade of 92.00 You will receive a A in this class.
Susan has an average grade of 52.33 You will receive a F in this class.
Jake has an average grade of 66.33 You will receive a D in this class.
Karen has an average grade of 77.33 You will receive a C in this class.
Bill has an average grade of 99.00 You will receive a A in this class.
Fred has an average grade of 85.33 You will receive a B in this class.
Cheryl has an average grade of 75.00 You will receive a C in this class.
Pam has an average grade of 65.00 You will receive a D in this class.
Steve has an average grade of 45.00 You will receive a F in this class.
John has an average grade of 86.33 You will receive a B in this class.
David has an average grade of 81.67 You will receive a B in this class.
Corina has an average grade of 91.67 You will receive a A in this class.
Delia has an average grade of 74.00 You will receive a C in this class.
Evan has an average grade of 99.00 You will receive a A in this class.

Overall Class Average is 21.67 ****HERE'S THE PROBLEM*****


The following lists the number of students earning each letter grade:

Number of A's = 4
Number of B's = 4
Number of C's = 3
Number of D's = 2
Number of F's = 2


The following program generates 3 random numbers, then averages them.

The average of 22 43 49 is 38
Zeeshan Sheikh
Ranch Hand

Joined: Nov 20, 2011
Posts: 144



I think reason you are not getting right results because you are dividing character type by double. That's the only logical error.


MySQL Blog
http://mysqlearner.blogspot.com/
Sumiran Pradhan
Greenhorn

Joined: Mar 10, 2010
Posts: 12
Basically, you need to create another variable that is going to sum all your subjects or averages and then calculate. The formula that you use is incorrect.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting the average to display