The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Draw a UML diagram (with correct dependency, aggregation, composition, inheritance etc.) for the Java program listed below:
Note: I know this code is bad and should be using inheritence etc. I just need opinions on how it all fits together as it is now. Don't worry about showing the method names and data members. I just need to see how the classes relate to eachother.
----------------------------------------------------------------------------------------
public class university
{ public static void main(String[] args)
{
    School engSchool = new School("Fulton Schools of Engineering");
  Student s = new Student("John", "William", "Freshman", "CS/CSE", 3.5);
  Faculty f = new Faculty("Janaka", "Balasooriya", "CIDSE", "SOA", false, 1000.00, 0);
  OfficeStaff os= new OfficeStaff("Nancy", "Wilfred", true , 0, 20.00);
  TechnicalSupportStaff ts = new TechnicalSupportStaff("Chris", "Kevin" , "Database", false, 12000.50, 0);
  engSchool.addstudent(s);
  engSchool.addfaculty(f);
  engSchool.addofficeStaff(os);
  engSchool.addTSS(ts);
  engSchool.displaySchoolInfo();
}
}
----------------------------------------------------------------------------------------
public class School
{
private String schoolName;
private ArrayList <Student> students;
private ArrayList <Faculty> faculty;
private ArrayList <OfficeStaff> o_staff;
private ArrayList <TechnicalSupportStaff> ts_staff;
public School(String name)
{
schoolName = name;
students = new ArrayList();
faculty = new ArrayList();
o_staff = new ArrayList();
ts_staff = new ArrayList();
}
----------------------------------------------------------------------------------------
public class Faculty
{
private String firstName;
private String lastName;
private String department;
private String researchArea;
private double monthly_salary;
private boolean hourlyPaid;
private double hourlyRate;
public Faculty(String fName, String lName, String dep, String res, boolean hp, double ms, double hr)
{
firstName= fName;
lastName = lName;
department = dep;
researchArea = res;
hourlyPaid = hp;
monthly_salary = ms;
hourlyRate = hr;
}
public void viewFaculty()
{
System.out.println();
System.out.println("First Name:" + firstName);
System.out.println("Last Name:" + lastName);
System.out.println("Department:" + department);
System.out.println("Research Area:" + researchArea);
if(hourlyPaid)
  System.out.println("Hourly Rate:" + hourlyRate);
else
  System.out.println("Monthly Salary:" + monthly_salary);
}
}
----------------------------------------------------------------------------------------
Office Staff, Student, and TechnicalSupport all have the same methods as 'Faculty'.
-----------