Asked by Big Daddy
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.
Answers
Answered by
MathMate
Please post also <i>your</i> question, for example, what you have done, where is your difficulty, or what kind of help you need.
Answered by
solo
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(......)
{
......
}
}
{
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(......)
{
......
}
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.