• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Getting the average to display

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 144
MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I think reason you are not getting right results because you are dividing character type by double. That's the only logical error.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 child proofed my house but they still get in. Distract them with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic