Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    HELP write a program that records a student's grades and calculates the average grade

    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.

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,728
    Thanks
    41
    Thanked 191 Times in 190 Posts
    so what have you done so far?

    Code:
    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

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •