Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

American International University- Bangladesh

Faculty of Science and Technology


Department of Computer Science

CSC 1205: Object Oriented Programming 1 (JAVA)

Mid Semester Assignment


Summer 19-20

Student Name: Anu, Ahamed Zubair


Student Id: 17-35994-3
Section: R
Program: BSc. CSSE

Course Teacher: Tanvir Ahmed


01. Write your codes here

class Person{
String name;
int age;

public Person(){}
public Person(String name,int age){
this.setName(name);
this.setAge(age);
}

public void setName(String name){


this.name = name;
}
public void setAge(int age){
this.age = age;
}

public String getName(){


return this.name;
}
public int getAge(){
return this.age;
}

public void showInfo(){


System.out.println("Name : " + this.getName());
System.out.println("Age : " + this.getAge());
}
}
class Doctor extends Person
{
private String workingId;
private String specialization;

public Doctor(){}
public Doctor(String name, int age,String workingId, String specialization ){
super(name,age);
this.setWorkingId(workingId);
this.setSpecialization(specialization);
}

public void setWorkingId(String workingId){


this.workingId = workingId;
}
public void setSpecialization(String specialization){
this.specialization = specialization;
}

public String getSpecialization(){


return this.specialization;
}
public String getWorkingId(){

American International University-Bangladesh (AIUB)


return this.workingId;
}

public void showInfo(){


super.showInfo();
System.out.println("Working Id : " + this.getWorkingId());
System.out.println("Designation : " + this.getSpecialization());
}
}
public class Main
{
public static void main(String args[])
{
Doctor d1=new Doctor("Devi Shetty", 45,"1101-1","Executive Director");
d1.showInfo( );
}
}

American International University-Bangladesh (AIUB)

You might also like