[SOLVED] Ready to Program Java IDE Problem #2
Hello Everyone,
Here is my assignment:
Create a program that enters in 5 student names and their 4 subject marks. It should calculate the student's average. A value should then be entered between 1 and 5, and then the student with that index will have their report card printed with their name, 4 marks and average. Include a pass or fail message for each mark and the average.
Here is what I have done so far:
// The "Unit4Activity3Assignment2" class.
import java.awt.*;
import hsa.Console;
public class Unit4Activity3Assignment2
{
static Console c; // The output console
public static void main (String[] args)
{
c = new Console ();
int number;
double sum, average;
sum = 0;
String[] names = new String[5];
double[] marks = new double[4];
c.println ("5 student names and their 4 subject marks:");
for(int i = 0; i < 5; i+=1)
{
c.println ();
c.print ("Student Name: ");
names[i] = c.readLine();
c.println ();
for(int j = 0; j < 4; j+=1)
{
c.print ("Subject Mark: ");
marks[j] = c.readDouble();
sum = sum + marks[j];
}
average = sum / 4;
c.println ();
c.println (names[i] + "'s Average: " + average);
c.println ();
sum = 0;
}
} // main method
} // Unit4Activity3Assignment2 class
Help on this "A value should then be entered between 1 and 5, and then the student with that index will have their report card printed with their name, 4 marks and average. Include a pass or fail message for each mark and the average." would be greatly appreciated.
Thanks.