import java.io.*;
class Student {
String n,c,s;
int r,sem;
Student(){};
void get(String name, String cou, String ses, int roll, int seme)
{
n=name;
c=cou;
s=ses;
r=roll;
seme=sem;
}
void display(){System.out.println("Name: "+n+"\nCourse: "+c+"\nSession: "+s+"\nRoll: "+r+"\nSemester: "+sem);}
}
class Marks extends Student{
int m[]=new int[3];
Marks()
{
super();
m[0]=m[1]=m[2]=0;
}
void get(int marks[])
{
m[0]=marks[0];
m[1]=marks[1];
m[2]=marks[2];
}
void display()
{
Student:display();
System.out.println("Makrs:\n"+m[0]+"\t"+"\t"+m[1]+"\t"+m[2]);
}
}
class Main{
public static void main(String args[])throws IOException
{
InputStreamReader ni=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(ni);
Marks obj1=new Marks();
System.out.print("Enter Student's name:");
String name=String.valueOf(in.readLine());
System.out.print("Enter course:");
String cou=String.valueOf(in.readLine());
System.out.print("Enter session:");
String ses=String.valueOf(in.readLine());
System.out.print("Enter roll number:");
int roll=Integer.parseInt(in.readLine());
System.out.print("Enter semester:");
int seme=Integer.parseInt(in.readLine());
obj1.get(name,cou,ses,roll,seme);
System.out.print("Enter marks of three subjects:");
int marks[]=new int[3];
marks[0]=Integer.parseInt(in.readLine());
marks[1]=Integer.parseInt(in.readLine());
marks[2]=Integer.parseInt(in.readLine());
obj1.get(marks);
obj1.display();
}
}
class Student {
String n,c,s;
int r,sem;
Student(){};
void get(String name, String cou, String ses, int roll, int seme)
{
n=name;
c=cou;
s=ses;
r=roll;
seme=sem;
}
void display(){System.out.println("Name: "+n+"\nCourse: "+c+"\nSession: "+s+"\nRoll: "+r+"\nSemester: "+sem);}
}
class Marks extends Student{
int m[]=new int[3];
Marks()
{
super();
m[0]=m[1]=m[2]=0;
}
void get(int marks[])
{
m[0]=marks[0];
m[1]=marks[1];
m[2]=marks[2];
}
void display()
{
Student:display();
System.out.println("Makrs:\n"+m[0]+"\t"+"\t"+m[1]+"\t"+m[2]);
}
}
class Main{
public static void main(String args[])throws IOException
{
InputStreamReader ni=new InputStreamReader(System.in);
BufferedReader in=new BufferedReader(ni);
Marks obj1=new Marks();
System.out.print("Enter Student's name:");
String name=String.valueOf(in.readLine());
System.out.print("Enter course:");
String cou=String.valueOf(in.readLine());
System.out.print("Enter session:");
String ses=String.valueOf(in.readLine());
System.out.print("Enter roll number:");
int roll=Integer.parseInt(in.readLine());
System.out.print("Enter semester:");
int seme=Integer.parseInt(in.readLine());
obj1.get(name,cou,ses,roll,seme);
System.out.print("Enter marks of three subjects:");
int marks[]=new int[3];
marks[0]=Integer.parseInt(in.readLine());
marks[1]=Integer.parseInt(in.readLine());
marks[2]=Integer.parseInt(in.readLine());
obj1.get(marks);
obj1.display();
}
}
No comments:
Post a Comment