Post a New Question

Java

posted by .

create a java program that accepts students names, and test scores from a file, and displays theri name, average score and letter grade to the screen.

  • Java -

    Please post also your question, for example, what you have done, where is your difficulty, or what kind of help you need.

  • Java -

    class LastnameA6
    {
    static final NUMBEROFSTUDENTS = 5;
    public static void main(String[] args)
    {
    //variable declaration
    int test1, test2, test3, test4, test5; // variables to hold the values for the five test scores
    double courseAvg = 0; // the average course score for each student
    double classAvg = 0; // the average score for the whole class
    String name; // variable to hold student name
    char grade; // the grade scale 'A', 'B', 'C', 'D', 'F'

    // add code here for the input(Assign7Input.txt) and output files (Assign7Output.txt)
    ......

    // print the heading to the output text file.
    System.out.println ("Student Test1 Test2 Test3 Test4 Test5 Average Grade");

    for (int i = 0; i < NUMBEROFSTUDENTS; i++)
    {
    // add your code here to read the input and do the calculation
    { if
    (grade <= 59)grade = F;
    else
    if (grade >= 60 && grade <=69)grade = D;
    else
    if (grade >=70 && grade <=79)grade = C;
    else
    if (grade >= 80 && grade <=89)grade = B;
    else
    if (grade >= 90 && grade <=100)grade = A;
    // the following are from method call which to be completed later
    courseAve = calculateAverage (test1, test2, test3, test4, test5);
    grade = calculateGrade(courseAvg);

    ......

    }

    // add your code to calculate and output the class average
    ......

    }

    // Method 1: calculate the average grade from the five test scores
    ...... calculateAverage( ...... )
    {
    ......
    }

    // Method 2: calculate the grade scale 'A', 'B', 'C', 'D', 'F'
    ......calculateGrade(......)
    {
    ......
    }
    }

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

More Related Questions

Post a New Question