Student Abstruct (1)
Student Abstruct (1)
GraduateStudent UnderGraduateStudent
طﺎﻟب اﻟﻣﺎﺟﺳﺗﯾر طﺎﻟب اﻟﺑﻛﺎﻟورﯾوس
-2طﺎﻟﺑﺎﻟﻣﺎﺟﺳﺗﯾر:GraduateStudent
درﺟﺔ اﻟﻧﺟﺎح = 70
Page 1 of 6
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package student1;
/**
*
* @author Ebrahim
*/
import java.util.Scanner;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
float g1=s.nextFloat();
float g2=s.nextFloat();
float g3=s.nextFloat();
s1.setTestScore(i, k);
float sum=s1.computeCourseGrade();
g1=s.nextFloat();
g2=s.nextFloat();
g3=s.nextFloat();
i=s.nextInt();
k=s.nextFloat();
s2.setTestScore(i, k);
sum=s2.computeCourseGrade();
Page 3 of 6
System.out.println("Sudent name = "+s2.getStudentName() + ""
+ " g1 = "+s2.test[0]+" g2 = "+s2.test[1]+ " g3 = "+s2.test[2]
+"sum = "+sum +" result = "+s2.courseGrade);
Student(String studentName)
{
this.studentName=studentName;
test=new float[NUM_OF_TESTS];
courseGrade="****";
}
String getCourseGrade()
{
return courseGrade;
Page 4 of 6
}
String getStudentName()
{
return this.studentName;
}
abstract float computeCourseGrade();
@Override
float computeCourseGrade()
{
float sum=0;
for (int i=0;i<test.length;i++)
sum=sum+test[i];
if(sum>=70)
courseGrade="pass";
else
courseGrade="Faild";
return sum;
}
Page 5 of 6
}
@Override
float computeCourseGrade()
{
float sum=0;
for (int i=0;i<test.length;i++)
sum=sum+test[i];
if(sum>=50)
courseGrade="pass";
else
courseGrade="Faild";
return sum;
}
}
Page 6 of 6