Experiment No.5: (For Applied/experimental Sciences/materials Based Labs)
Experiment No.5: (For Applied/experimental Sciences/materials Based Labs)
5
Write a program in java that implements interface Student which has two methods Display_Grade and
Attendance for PG_Students and UG_Students (PG_Students and UG_Students are two different classes for
Post Graduate and Under Graduate Students respectively).
Write a program in java that implements interface Student which has two methods
Display_Grade and Attendance for PG_Students and UG_Students (PG_Students
and UG_Students are two different classes for Post Graduate and Under Graduate
Students respectively).
2. Task to be done:
Java Class:-
Java is an object-oriented programming language. Everything in Java is associated
with classes and objects, along with its attributes and methods. ... A Class is like an
object constructor, or a "blueprint" for creating objects.
6. Steps for experiment/practical:
Program:-
interface Student
void Display_Grade();
void Display_Atten();
PG_Student(String name, int m1, int m2, int m3, int attendence)
this.name = name;
this.m1 = m1;
this.m2 = m2;
this.m3 = m3;
this.attendence = attendence;
void Display()
{
total = m1 + m2 + m3;
grade = "A";
grade = "B";
grade = "C";
else
grade = "D";
UG_Student(String name, int m1, int m2, int m3, int attendence)
this.name = name;
this.m1 = m1;
this.m2 = m2;
this.m3 = m3;
this.attendence = attendence;
void Display()
}
public void Display_Grade()
total = m1 + m2 + m3;
grade = "S";
grade = "A";
grade = "B";
grade = "C";
else
{
grade = "D";
class Demo {
pg.Display();
pg.Display_Atten();
pg.Display_Grade();
ug.Display();
ug.Display_Atten();
ug.Display_Grade();
}
7. Observations/Discussions(For applied/experimental sciences/materials based labs):
In this program we observe the range of grade put by the user and the uses of
interface
8. Percentage error (if any or applicable):
9. Result/Output/Writing Summary:
10. Graphs (If Any): Image /Soft copy of graph paper to be attached here
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):