Tuesday, June 9, 2015

Project 2 / College Info


public class CollegeInfo {

public static void main(String[] args) {

College collegeSky = new College("Sky college", "Butwal", 300, 10, 20);
collegeSky.getInfo();
collegeSky.getStudent();
collegeSky.getTeachers();
collegeSky.getExtraStaffs();

System.out.println("\n");

College collegeKshitiz = new College("Kshitiz", "Kalika Nagar", 3000, 100, 80);
collegeKshitiz.getInfo();
collegeKshitiz.getStudent();
collegeKshitiz.getTeachers();
collegeKshitiz.getExtraStaffs();
}
}

-----------------------------------------------------------

public interface CollegeInterface {

void getInfo();
void getStudent();
void getTeachers();
void getExtraStaffs();
}

---------------------------------------------------------------

public class College implements CollegeInterface{

String clzName;
String city;
int studNo;
int staffNo;
int teachersNo;

public College(String clzName, String city, int studNo, int staffNo , int teachersNo) {
this.clzName = clzName;
this.city = city;
this.studNo = studNo;
this.staffNo = staffNo;
this.teachersNo = teachersNo;
}
@Override
public void getInfo() {
System.out.println("This "+ clzName + " college is situated in "+city+" city");
}

@Override
public void getStudent() {
System.out.println("This "+ clzName+ " college have minimum "+ studNo + " students in the college");
}

@Override
public void getTeachers() {
System.out.println("The "+ clzName+" college have "+teachersNo+" teachers including secondary and higher secondary");
}

@Override
public void getExtraStaffs() {
System.out.println("This "+ clzName+ " college have minimum "+ teachersNo + " teachers in the college");
}
}

----------------------------------------------------------------------------------


No comments:

Post a Comment