School report notebook kit (cover, binder spine, divider tabs)



Model Answerpackage communitymembertest;import java.util.Scanner;import testdate.Date;public class Teacher extends Faculty { private String[] Courses; private boolean Theoretical; //true stands for theoretical, and false for practical. private int WorkingHours; //normally 40/week, assume that each month has 4 weeks. public Teacher(String FName, String LName, String ssn, Date dob, String title, double salary, Date hireDate, String degree, String specality, int numberOfCourses, char Responsibility, int WorkingHours) { super(FName, LName, ssn, dob, title, salary, hireDate, degree, specality); this.Courses=new String[numberOfCourses]; this.Theoretical=(Responsibility=='t'?true:false); //t-->Theoretical, p-->Practical. this.WorkingHours=WorkingHours; InputCourses(); } public void setTheoretical(boolean theoretical) { this.Theoretical=theoretical; } public void setWorkingHours(int workingHours) { this.WorkingHours=workingHours; } public boolean isTheoretical() { return Theoretical; } public int getWorkingHours() { return WorkingHours; } public double computeSalary() { if(WorkingHours>40) { int extraHours=WorkingHours-40; return getSalary()+(extraHours*100*4); //assume that each month has 4 weeks. } return getSalary(); } @Override public String toString() { String CoursesTitlesList=""; for(String title: Courses) CoursesTitlesList+=title+","; return "Teacher{" + super.toString() + "\nResponsibility=" + (Theoretical ? "Theoretical ":"Practical") + ", WorkingHours=" + WorkingHours + ", and is Teaching: "+ CoursesTitlesList+'}'; } private void InputCourses() { Scanner input=new Scanner(System.in); int i; for(i=0; i<Courses.length; i++) { System.out.print("Enter the course title: "); Courses[i]=input.nextLine(); } }}package communitymembertest;import testdate.Date;public class CommunityMemberTest { public static void main(String[] args) { Teacher teacher=new Teacher("Lina", "Fahd", "167000000", new Date(2,6,1976),"Assistant Professor", 11000, new Date(9,10,2009), "PhD", "Computer Sciences",2,'t',43); System.out.println(teacher); System.out.println(teacher.getFullName()+" Full Salary: "+puteSalary()); }} ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download