...

View Full Version : HELP write a program that records a student's grades and calculates the average grade



mandeep
11-23-2011, 01:18 AM
To calculate the GPA, you will need to record the final grade and the credit value for each course the
student has taken in the term. A student can take any number of courses in a term, and you don't know
how many courses the student is recording while the program runs. You will need to continually ask the
user if they'd like to enter more data, and if they confirm, collect the data for another course. After all
the data has been recorded, display the average grade and the GPA.
Credit value can't be negative, and no course can have more than 9 credits. Some courses have halfcredits (e.g. a course can be .5 credits, 1.5 credits, 6 credits, etc.)
Grades can't be negative, and can't be more than 110%.

Your program must include the following methods:
getValidNumber() - retrieves a valid double from the user.
o Requires the Scanner object, a prompt String, a minimum double value and a max
double value as inputs.
o Returns a valid double value between the min and max value (inclusive).
o The method should prompt the user to enter the desired value, and retrieve a double
value using the Scanner parameter. o If the Scanner's nextDouble() method throws an exception because the user enters an
invalid double, the message "Error: Value must be between 0.0 and 110.0." (for grade
value) or "Error: Value must be between 0.0 and 10.0." (for credit value) should be
displayed.
o If the double value entered is not between the min and max value (inclusive), the
message "Error: All values entered must be numeric." should be displayed.
o The user is continually prompted until a valid double value can be returned.
getPoints() - determines the grade point assigned to a specific final grade value
o Requires a final grade as an input (double value).
o Returns a double value representing the grade point value for the value of the grade
parameter.
o Only valid values will be input into this method, however any grade less than 0 still
results in a grade point value of 0, so if your method is written correctly, this won't be a
concern.

alykins
11-23-2011, 04:19 AM
so what have you done so far?



int i=0;
while(!DoneEnteringCourses)
{
ask for a course and grade or end process
if{
read in the course name and grade recieved
populate two arrays @ [i] (ie string[i] & int[i])
i++;
}
else
{
i++; // here we add the 1 to the i because we can now use i
//for number of slots in array
DoneEnteringCourses = true;
}


that's a start... I'm not going to flow the whole program... this
is not real java; it is pseudo-code (and my own little hybrid of that is
like C#)... I find it easier to translate it over then... anyways
flow it out and then get more help building it... if you need help flowing
it ask where you are stuck on... flow it to match all requirements



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum