This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Customer Requirements for Developers and have Marcho Behler on-line!
See this thread for details.
The moose likes Java in General and the fly likes Pls help on this read Input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

Pls help on this read Input

Jeannie Kaw

Joined: Apr 30, 2002
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
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;

BufferedReader input = new BufferedReader(new InputStreamReader(;
System.out.println("Enter your Name:");
System.out.println("Enter your mark1");
System.out.println("Enter your mark2");
System.out.println("Enter your mark3");

for(int i =0; i <=14; i++)
Studname = input.readLine();
mark1= Integer.parseInt(input.readLine());
mark2= Integer.parseInt(input.readLine());
mark3= Integer.parseInt(input.readLine());
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");
if (avg < 60)
System.out.println ("PASS");
if (avg < 70)
System.out.println ("CREDIT");
System.out.println ("DISTINCTION");
System.out.println ();

System.out.println ("Highest Average = " + highestAvg);
System.out.println ("Lowest Average = " + lowestAvg);
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

respond in this thread. We are still waiting for your response there to tell us the problem you are having.
I agree. Here's the link:
subject: Pls help on this read Input
It's not a secret anymore!