Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners answer me this program
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Raghavendra Aditya T
answer me this program
1 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners


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


Advertisement
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);
}
}
}


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
please send me the answer - JDBC
please send me the answer -difference between DriverManager and DataDourse   what is Datasourse? What r the advantages? what is the difference between DriverManager and DataDourse
Please answer me - JSP-Servlet
Please answer me  Hello Guys, this is the third time I'm sending this question. But I've not got the right answer from you. The again is: I need java... 2000 NOT MySQL. Please assist me and for other questions I've asked before
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
pls give me answer ae soon as possible - Ajax
pls give me answer ae soon as possible  i m writing code of ajax technology ...but it is not working pls check it n give me response quickly... give me quick response!!! thanks & regards shashank gupta
need the answer vry urgently..plz help me...[plzzzzzzzz
need the answer vry urgently..plz help me...[plzzzzzzzz  the question...... useing struts or servlet... in eclipse platform...can any one tell me the source code...hpw to write in eclipse platform....plz plz mail me
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
hello sir, please give me answer - Java Beginners
hello sir, please give me answer  Write a program in Java... please tell me full solution of this program   Here is your complete program:File name :count.java---------------------import java.io.*;class count
provide me the program for that ques.
provide me the program for that ques.  wtite a program in java there is a class readchar.the functionality of this class is to read a string from the console and display the characters of that string on the console.   
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 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
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
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
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
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  
please help me for this program - Java Beginners
please help me for this program   Write a program that asks the user for a starting value and an ending value and then writes all the integers (inclusive) between those two values. Enter Start: 10 Enter End: 14 10
plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line...;Hi Friend, Output of this program is: a=2 b=0 c=0 mul=27 volume=18
Advertisements
 

 

 

DMCA.com