|
| 1 | +import SY.*; |
| 2 | +import TY.*; |
| 3 | +import java.util.*; |
| 4 | + |
| 5 | +public class Student |
| 6 | +{ |
| 7 | + int rno; |
| 8 | + String name; |
| 9 | + SYmarks sy; |
| 10 | + TYmarks ty; |
| 11 | + double per; |
| 12 | + char grade; |
| 13 | + Student(int rno,String name,int ct,int mt,int et,int Theory,int Practicals) |
| 14 | + { |
| 15 | + sy=new SYmarks(ct, mt, et); |
| 16 | + ty=new TYmarks(Theory, Practicals); |
| 17 | + this.rno=rno; |
| 18 | + this.name=name; |
| 19 | + perCalc(ct, mt, et, Theory, Practicals); |
| 20 | + Grade(); |
| 21 | + } |
| 22 | + void perCalc(int ct,int mt,int et,int Theory,int Practicals) |
| 23 | + { |
| 24 | + this.per=(double)(ct+mt+et+Theory+Practicals)/5; |
| 25 | + } |
| 26 | + |
| 27 | + void Grade() |
| 28 | + { |
| 29 | + if(per>=70) |
| 30 | + grade='A'; |
| 31 | + else if(per>=60) |
| 32 | + grade='B'; |
| 33 | + else if(per>=50) |
| 34 | + grade ='C'; |
| 35 | + else if(grade>=40) |
| 36 | + grade='D'; |
| 37 | + else |
| 38 | + grade='F'; |
| 39 | + } |
| 40 | + void disp() |
| 41 | + { |
| 42 | + System.out.println(rno+name+sy+ty+per+grade); |
| 43 | + } |
| 44 | + public static void main(String[] args) |
| 45 | + { |
| 46 | + Scanner sc=new Scanner(System.in); |
| 47 | + System.out.println("Enter Limit "); |
| 48 | + int n=sc.nextInt(); |
| 49 | + Student ob[]= new Student[n]; |
| 50 | + for (int i =0;i<n;i++) |
| 51 | + { |
| 52 | + System.out.println("Enter roll no :: "); |
| 53 | + int r=sc.nextInt(); |
| 54 | + System.out.println("Enter Name :: "); |
| 55 | + String nm=sc.next(); |
| 56 | + System.out.println("Enter Computer Marks :: "); |
| 57 | + int c=sc.nextInt(); |
| 58 | + System.out.println("Enter MAth MArks"); |
| 59 | + int m=sc.nextInt(); |
| 60 | + System.out.println("Enter Eletronic marks"); |
| 61 | + int e=sc.nextInt(); |
| 62 | + System.out.println("Enter Theory marks"); |
| 63 | + int t=sc.nextInt(); |
| 64 | + System.out.println("Enter Practal marks"); |
| 65 | + int p=sc.nextInt(); |
| 66 | + ob[i]=new Student(r, nm, c, m, e, t, p); |
| 67 | + ob[i].disp(); |
| 68 | + } |
| 69 | + |
| 70 | + |
| 71 | + } |
| 72 | + |
| 73 | +} |
0 commit comments