answer me this program

Ads
 

answer me this program

Java Code to Maintain student record,Name, Age, Marks of 5 subjects for a Student,Display Student age and name,Calculate Average of all marks and display it

View Answers

March 3, 2011 at 12:26 PM

Java student record

import java.util.*;

public class StudentExample{
String name;
int age;
int sub1;
int sub2;
int sub3;
int sub4;
int sub5;
int totalMarks;
int average;
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setAge(int age){
this.age=age;
}
public int getAge(){
return age;
}
public void setSub1(int sub1){
this.sub1=sub1;
}
public int getSub1(){
return sub1;
}
public void setSub2(int sub2){
this.sub2=sub2;
}
public int getSub2(){
return sub2;
}
public void setSub3(int sub3){
this.sub3=sub3;
}
public int getSub3(){
return sub3;
}
public void setSub4(int sub4){
this.sub4=sub4;
}
public double getSub4(){
return sub4;
}
public void setSub5(int sub5){
this.sub5=sub5;
}
public int getSub5(){
return sub5;
}
public void setTotalMarks(int totalMarks){
this.totalMarks=totalMarks;
}
public int getTotalMarks(){
return totalMarks;
}
public void setAverage(int average){
this.average=average;
}
public int getAverage(){
return average;
}
public static void main(String[]args){
Scanner input=new Scanner(System.in);
StudentExample data[]=new StudentExample[2];
for (int i=0; i<data.length; i++) {
System.out.println("Enter Name");
String name=input.next();
System.out.println("Enter Age");
int age=input.nextInt();
System.out.println("Enter marks of subject 1");
int m1=input.nextInt();
System.out.println("Enter marks of subject 2");
int m2=input.nextInt();
System.out.println("Enter marks of subject 3");
int m3=input.nextInt();
System.out.println("Enter marks of subject 4");
int m4=input.nextInt();
System.out.println("Enter marks of subject 5");
int m5=input.nextInt();
int tm=m1+m2+m3+m4+m5;
int avg=tm/5;
data[i] = new StudentExample();
data[i].setName(name);
data[i].setAge(age);
data[i].setSub1(m1);
data[i].setSub2(m2);
data[i].setSub3(m3);
data[i].setSub4(m4);
data[i].setSub5(m5);
data[i].setTotalMarks(tm);
data[i].setAverage(avg);
}
System.out.println();
System.out.println("Student Information");
for(int i=0;i<2;i++){
StudentExample show = data[i];
String name=show.getName();
int age=show.getAge();
int m1=show.getSub1();
int m2=show.getSub1();
int m3=show.getSub1();
int m4=show.getSub1();
int m5=show.getSub1();
int tm=show.getTotalMarks();
int avg = show.getAverage();
System.out.println(name + " \t " + age + "\t " + m1+"\t "+m2+"\t "+m3+"\t "+m4+"\t "+m5+"\t "+tm+"\t "+avg);
}
}
}

Ads









Related Tutorials/Questions & Answers:
answer me this program
answer me this program  Java Code to Maintain student record,Name, Age, Marks of 5 subjects for a Student,Display Student age and name,Calculate Average of all marks and display it   Java student record import
answer me this program
answer me this program  Java Code to Maintain student record,Name, Age, Marks of 5 subjects for a Student,Display Student age and name,Calculate Average of all marks and display it   Java student record import
Advertisements
Please give me the answer.
"int a=08 or 09" its giving compile time error why   "int a=08 or 09" its giving compile time error why ? can any one give me the answer of this please
please answer me
please answer me  iam using html in select tag.in this one option i selected and that option data will be display in table.And use servlet with html and how to retrieve the data from data base
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer  Discuss & Give brief description about string class methods   Java string methods
GIVE ME A ANSWER
GIVE ME A ANSWER  Discuss the Number Class in the java.lang package   Number class is an abstract class extended by all classes that represent numeric primitive types such as Byte, Short, Integer, Long, Float
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
Plz send me answer quckly
Plz send me answer quckly  Respected Sir, myself is pavan shrivastava.i want ask a question that is ( we can't create object of interface then how would possible to create object
please i want someone to answer me pleeeeeeeeeeeeease...
please i want someone to answer me pleeeeeeeeeeeeease...    Write a JAVA program using 2D array to auto-grade exams. For a class of N students, your... answer key as Final Array in your program.( using 2D array
Answer me ASAP, Thanks, very important
Answer me ASAP, Thanks, very important  Sir, how to fix this problem in mysql i have an error of "Too many connections" message from Mysql server,, ASAP please...Thanks in Advance
What is the answer and how the program work?
What is the answer and how the program work?  public class Threads2 implements Runnable { public void run() { System.out.println("run."); throw... is the out put of the program
how to get following answer in turbo c program
how to get following answer in turbo c program  input 123456789 output 1 2 3 4 5 6 7 8 9
Please explain me the flow of this program..
Please explain me the flow of this program..  // Substring replacement. class StringReplace { public static void main(String args[]) { String org = "This is a test. This is, too."; String search
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
please explain me the flow of this program
please explain me the flow of this program  class Bticket extends Thread { Object train,comp; Bticket(Object train,Object comp){ this.train=train; this.comp=comp; } public void run(){ synchronized
hi,i'am new to Jsp.Can some one please let me know an answer for this question?
hi,i'am new to Jsp.Can some one please let me know an answer for this question?  how do we upload an xml file and validate them against WIPO DTD
please give me an idea to develop a program for this question?
please give me an idea to develop a program for this question?  How to enter a text or number from keyboard without using InputStreamReader method in java
compile this program and let me know the resolution
compile this program and let me know the resolution  class Maxof2{ public static void main(String args[]){ //taking value as command line...+" is greater than "+i); } } please compile and let me know the resolution  
java program for me to see who are on my server
java program for me to see who are on my server  Hello, Im a beginner in java, doing some tutorials and stuff. I wanna write a java program to put on my server where i wanna see if like 3 people are on my server PLUS that i want
Help me to write this simple java frame program
Help me to write this simple java frame program   I want to write a Java program for.... To create a frame with 4 text fields;name,street,city and pin;with suitable labels. Also add a button "OK". After enter values
please help me in coding this given program
please help me in coding this given program  consider the below... are the prime numbers in ascending order write a program to find the nth term in this series. (i m unable to code this program..please provide solution
please help me in coding this given program
please help me in coding this given program  consider the below... are the prime numbers in ascending order write a program to find the nth term in this series. (i m unable to code this program..please provide solution
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 2 1 1 3 4 3 1 1 4 7 7 4 1
please help me to write a code for this program
please help me to write a code for this program   1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
plese tell me the control flow of this program
plese tell me the control flow of this program  public class starForTest { public static void main(String [] args) { for (int... k....? plese tell me the control flow
please tell me the flow of execution of this program
please tell me the flow of execution of this program  class Test{ int x; Test(int x){ this.x=x; } static void access(){ System.out.println("x= "+x); }} class Static{ public static void main(String ar[]){ Test obj=new Test(55
please give me a java program for the following question
please give me a java program for the following question  Write a java program that displays multiple frames : Step 1: Design a frame with three buttons: ?Fruit?, ?Bird? and ?Animal? Step 2: On clicking ?Fruit? button
please eslain me the flow of execution of this program
please eslain me the flow of execution of this program  class Producer extends Thread { StringBuffer sb; boolean dataprodover = false; Producer(){ sb = new StringBuffer(); } public void run(){ for(int i=1;i<=10;i++){ try

Ads