I have a class project where we must create a program that takes 5 grades of a student that the user inputs and stores them into an array and then gets the average of the 5 grades for example

Grades = 92 89 99 78 96

And then stores those numbers into an array and calculates the average and spits the average back out into a j-textfield

Any help is greatly appreciated thank you

5 Years
Discussion Span
Last Post by richieking

hi Mas49er,
Could you show some of your code,
without knowing how you tried we can't answer your question


Well you'll need something to get the input from the user, and than to separate that input in parts that will be stored in the array. Say, if you need to insert grades, I'll recomand you a class in which you'll get the whole stream inserted by the user, as

<<Insert grades (separated by space):
>>1 2 3 4 5 6 7 8

and than to split that stream with the delimitter being the space " " character/string and than to convert them to int and insert them in the array.

Edited by Lucaci Andrew

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.