tags:

views:

155

answers:

5
import java.io.DataInputstream;
class Student
{
int roll;
void getdata(int r)
 {
 roll=r;
 }
void putroll()
 {
 System.out.println("The roll number is: "+roll);
 }
}

class Test extends Student
{
int sub1,sub2;
void getmarks(int a, int b)
 {
 sub1=a;
 sub2=b;
 }
void putmarks()
 {
 System.out.println("Marks 1= "+ sub1 + "\n Marks 2= "+sub2);
 }

interface Sport
{
float spt=6.0f;
void putspt(float num);
}


class Result extends Test implements Sport
{
float total;
float n;
public void putspt(float num)
 {
 x=num;
 if(x>6 && x<=10)
 System.out.println("Sport= "+x);
 else
 System.out.println("Sport= "+spt);
 }
void display()
 {
 if(x>6 && x<=10)
 total=sub1+sub2+x;
 else
 total=sub1+sub2+spt;
 putroll();
 putmarks();
 if(x>6 && x<=10)
 putspt(x);
 else
 putspt(spt);
 System.out.println("Total marks= "+total);
 }
}


class Student_Test
{
public static void main(String a[]) throws Exception
 {
 DataInputStream ds = new DataInputStream(System.in);
 int a,b,c;
 float d;
 try
  {
  int t;
  System.out.println("\nEnter total no. of Students:");
  t=Integer.parseInt(ds.readLine());
  for(int i=1;i<=t;i++)
   {
    System.out.println("Enter Roll no.:");
    a=Integer.parseInt(ds.readLine());
    System.out.println("Enter the marks of two subjects:");
    b=Integer.parseInt(ds.readLine());
    c=Integer.parseInt(ds.readLine());
    System.out.println("Enter Sports marks:");
    d=Integer.parseInt(ds.readLine());
    Result r=new Result();
    r.getroll(a);
    r.getmarks(b,c);
    r.putspt(d);
    r.display();
   }
  }
  catch(Exception e)
    {
    System.out.println("ERROR");
    }
 }
}

I am getting the following error at compilation time:

Student.java:97: reached end of file while parsing }->

P.S: 97th line is the last line of the program

Can somebody help me to solve this error??

A: 

The Test class doesn't have a closing curly brace.

nasufara
oops!yeah that brace was missing..but now i am getting 17 errors..plz run the code..
compgeek
@compgeek: how about reading the compiler errors and trying to figure it out yourself? I know the errors are somewhat cryptic when you're new, but you'll figure it out. :) everyone else here has.
Esteban Araya
A: 

You're missing a } to close your Test class (about halfway in)

Uri
A: 

Class Test is missing a:

}
McAden
A: 

Check the closing brackets.

swegi
+6  A: 

You have missed the closing brace on class Test, before interface Sport.

As a side note, if you format (and specifically indent) your source code properly, you won't have such problems in the future.

Pavel Minaev
+1 for the side note. (When I was an undergraduate, solutions were marked down heavily if they were not properly commented and indented.)
Stephen C