0% found this document useful (0 votes)
2 views6 pages

Java Interfaces and Class Implementations

The document contains Java code examples demonstrating the use of interfaces and classes for a Teaching Assistant, Faculty, Student, and Orders. It includes implementations for displaying details of a Teaching Assistant, managing students and their guardians, and calculating order totals. The code is organized into three separate problems, each showcasing different object-oriented programming concepts.

Uploaded by

khabirshams2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Java Interfaces and Class Implementations

The document contains Java code examples demonstrating the use of interfaces and classes for a Teaching Assistant, Faculty, Student, and Orders. It includes implementations for displaying details of a Teaching Assistant, managing students and their guardians, and calculating order totals. The code is organized into three separate problems, each showcasing different object-oriented programming concepts.

Uploaded by

khabirshams2005
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name : Hasan Al Khabir

ID : 2024-3-60-344
Lab: 6
Problem 1:

package [Link].interface1;

interface Student {
int age=19;
void display();
}
package [Link].interface1;

interface Employee {
String designation= "Teacher";
void display();
}

package [Link].interface1;

public class TeachingAssistant implements Student,Employee {


public int id;
public String name;
public int salary;
public TeachingAssistant(int id,String name,int salary){
[Link]=id;
[Link]=name;
[Link]=salary;

}
@Override
public void display(){
[Link]("Teaching Assistant Details:");
[Link]("ID: "+id);
[Link]("Name: " + name);
[Link]("Salary: $" + salary);
}
}
package [Link].interface1;
public class Interface1 {

public static void main(String[] args) {


TeachingAssistant ta= new TeachingAssistant(10,"Rafsan Islam Taskin",15000);
[Link]();
}
}
Problem 2:

package [Link].interface2;
import [Link];
public class Faculty {
String name;
int id;
String dept;

ArrayList <Student> cse110=new ArrayList<>();


public void Teaches(Student s){
[Link](s);
}
}
package [Link].interface2;
import [Link];

public class Student {


String sName;
int sId;
String sDept;
Guardian g;
public Student(String sName,int sId,String sDept,String name,String relation){
[Link]=sName;
[Link]=sId;
[Link]=sDept;
g =new Guardian(name,relation);
[Link](sName+ " " +sId+ " " +sDept);
[Link]("Guardian" +name+ " " +relation );
[Link]( );
}
ArrayList <Faculty> cse110=new ArrayList<>();
public void Supervision(Faculty f){
[Link](f);
}
}

package [Link].interface2;

public class Guardian {


String gName;
String gRelation;
public Guardian (String gName, String gRelation){
[Link]=gName;
[Link]=gRelation;
}
}
package [Link].interface2;

public class Interface2 {

public static void main(String[] args) {


[Link]("Hello World!");
Student[] s= new Student[3];
s[0] = new Student("shams",10,"cse","ba","father");
s[1]=new Student("Sham",11,"cse","ba1","father");
s[2]=new Student("sha",12,"cse","ba3","father");
}
}

Problem 3:

package [Link].interface3;
public class Orders {
int id,quantity,unitPrice;
String status;
Date date;

public calcTotal(int total){


return total= unitPrice*quantity;
}
}
class OrderDetails{
String quality;
boolean taxStatus;
Orders order;
public OrderDetails(String qua,boolean tS,Orders ord){
quality=qua;
taxStatus = tS;
order =ord;
}

You might also like