Results 1 to 2 of 2
Thread: i want help >>>>
- 03-06-2012, 08:36 AM #1
Member
- Join Date
- Mar 2012
- Posts
- 1
- Rep Power
- 0
i want help >>>>
i went code to get the max ,min number and avg for the following code :
import java.util.Scanner;
class Student{
int mark1;
int mark2;
Student(int mar1, int mar2){
mark1=mar1;
mark2=mar2;
}
public int getMark1(){ return mark1; }
public int getMark2(){ return mark2;}
public int findTotal(){
int ft=mark1+mark2;
return ft;
}
}
class Driver{
public static void main(String[] arg){
Scanner sk=new Scanner(System.in);
Student[] stu=new Student[5];
for(int i=0; i<5; i++){
System.out.println("Enter the mark1 and mark2 of Student5: "+(i+1));
int mar1=sk.nextInt();
int mar2=sk.nextInt();
stu[i]=new Student(mar1,mar2);}
for(int i=0; i<5; i++){
System.out.println("Details of Rectangle "+(i+1));
System.out.println("=====================");
System.out.println("Mark1: "+stu[i].getMark1());
System.out.println("Height: "+stu[i].getMark2());
System.out.println("Total: "+stu[i].findTotal());
System.out.println("=====================");
}
}
}
i hope from you help me.gif)
thanx alot
-
Re: i want help >>>>
Sorry, this isn't a homework-doing service. We'll be more than happy to help you understand things so you can write code, but we're not here to provide you with code on demand. Please feel free to re-ask this question, just ask an actual question where you tell us where you're stuck or just what you don't understand. Please don't state that you "want code" though or your question will be locked again.


1Likes
LinkBack URL
About LinkBacks


Bookmarks