Question: This is my week 9 lab code:- import java.util.*; import java.io.*; import java.lang.*; class University{ private String name; private int worldRank; private ArrayList students; private

 This is my week 9 lab code:- import java.util.*; import java.io.*;

This is my week 9 lab code:-

import java.util.*; import java.io.*; import java.lang.*; class University{ private String name; private int worldRank; private ArrayList students; private ArrayList faculties; private ArrayList enrollments; public boolean setName(String name) { if(name.length()>=3) { this.name = name; return true; } return false; } public boolean setWorldRank(int rank) { if(rank>0) { this.worldRank = rank; return true; } return false; } public String getName() { return this.name; } public int getWorldRank() { return this.worldRank; } public ArrayList getStudentsList() { return this.students; } public ArrayList getFacultiesList() { return this.faculties; } public ArrayList getEnrollments() { return this.enrollments; } //add students in the University public int addStudent(String student) { for(int i=0;i(100); faculties = new ArrayList(100); enrollments = new ArrayList(100); } //parameterized constructor public University(String name,int rank) { setName(name); setWorldRank(rank); students = new ArrayList(100); faculties = new ArrayList(100); enrollments = new ArrayList(100); } }

public class Main {public static void main(String[] args) { University uni = new University("CMU",2); uni.addStudent("John"); uni.addStudent("Tim"); uni.addStudent("Emma"); uni.addStudent("Sally"); uni.addFaculty("FIT"); uni.addFaculty("LAW"); uni.addEnrollments("FIT","John"); uni.addEnrollments("LAW","Tim"); uni.addEnrollments("FIT","Emma"); System.out.println(uni.countStudentsFaculty("FIT")); System.out.println(uni.countStudentsFaculty("LAW")); } } 

Week10-Lab Add new features and specifications to the Week 9 app you have already developed. 9 1. Develop class Student that contains the following attributes and all the necessary methods and constructors: 1. name 2. age 3. fees 2. Develop class Faculty that contains the following attributes and all the necessary methods and constructors: 1. name 2. capacity 3. Develop class Enrollment that contains the following attributes and all the necessary methods and constructors: 1. instance of student 2. instance of faculty 4. Update all the arrays lists such that they accept instances of Student or Faculties instead of strings 5. Update the methods, addStudent), addFaculty),isStudent),isFaculty to accept instances of student and faculty classes instead of stirngs 6. Update the method addEnrollment such that it accepts an instance of student class and an instance of faculty class instead of two strings. The method addEnrollment must enrol the student if the student and faculty are available (ie exist in university students/faculties arraylists) and the faculty still have a capacity. 7. Update all the other methods (getters, setters, helpers) that use strings for students and faculty to accept and use instances of classes Student and Faculty 8. Develop the main method that creates an instance of the university class, adds students and faculty, adds enrollments, and tests the method 'countStudentsFaculty

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!