Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# Pls help on this read Input

Jeannie Kaw
Greenhorn
Posts: 5
Hi everybody,
I need ur assistance, as this program have errors, which i unable to correct it.
Appreciate your assistance on this matter.
Create a record contains 15 students and read the input from user.
1) We are free invited to enter the details of a Student with the name,and enter the 3 Marks obtained in each 3 subjects. (like..Integer.parseInt(input);read their input)
2) Compute the average score for each student, then display the highest average score and lowest average score.
Develop in Application and print out the input from what user entered.
Below is the source code
==================================================

//run this program as GoodLuck.java
import java.io.*;
import java.lang.*;
class GoodLuck
{
public static void main(String args[]) throws IOException
{
String[] name = new String[15];
int[] students = new int[15];
String Studname;
int mark1, mark2, mark3;

for(int i =0; i <=14; i++)
{
name[i] =Studname;
students[i] = mark1;
students[i] = mark2;
students[i] = mark3;

};
double highestAvg = -1.0;
double lowestAvg = 101.0;

for (int i = 0; i < students.length; i++)

for (int i = 0; i < students.length; i++)
{
double avg = (students[i].mark1 + students[i].mark2 +
students[i].mark3) / 3.0;
if (avg > highestAvg)
highestAvg = avg;
if (avg < lowestAvg)
lowestAvg = avg;
System.out.print (students[i].name + " " +
students[i]+ " " +
students[i]+ " " +
students[i]+ " " + avg + " ");
if (avg < 40)
System.out.println ("FAIL");
else
if (avg < 60)
System.out.println ("PASS");
else
if (avg < 70)
System.out.println ("CREDIT");
else
System.out.println ("DISTINCTION");
}
System.out.println ();

System.out.println ("Highest Average = " + highestAvg);
System.out.println ("Lowest Average = " + lowestAvg);
}
}

Jamie Robertson
Ranch Hand
Posts: 1879
respond in this thread. We are still waiting for your response there to tell us the problem you are having.
Jamie