Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Tasks (Java Code) 1a) Develop the 'University' class shell (i.e. the class body and its attributes) 1b) Develop a setter for each attribute. Each setter

Tasks (Java Code)

1a) Develop the 'University' class shell (i.e. the class body and its attributes)

1b) Develop a setter for each attribute. Each setter must return true if the provided value is valid; false otherwise

1c) Develop a getter for each attribute

1d) Develop a zero parameter constructor. You must initialize all the instance variables with some values. Hint: Don't forget to use the setters to set the values.

1e) Develop a two-parameter constructor for universityName and worldRank.

1f) Develop a method called 'addStudent(String)' that adds the input string, which is a student name, to the list of students (students ArrayList). The method must not accept duplication in the students' names.

1g) Develop a method called 'addFaculty(String)' that adds the input string, which is a faculty name, to the list of faculties (faculties ArrayList). The method must not accept duplication in the faculties' names.

1h) Develop a boolean method 'isStudent(String)' that takes as input a string represents a student name and returns true if it exists in the list of students; false otherwise

1i) Develop a boolean method 'isFaculty(String)' that takes as input a string represents a faculty name and returns true if it exists in the list of faculties; false otherwise

1j) Develop a method name ('addEnrollment') that takes two strings to represent a student name and a faculty. If the student name and the faculty are available (i.e. isStudent and isFaculty return true), then add the enrollment as 'studentname|facultyname' as shown above.

1k) Develop a toStirng method that returns the list of students, faculties and enrollments.

1l) Develop a method called 'countStudentsFaculty(String)' that takes as input a faculty name and returns an integer number that represents how many students enrolled in the that faculty. For example, if the enrollment ArrayList contains ["John|FIT", "Tim|Law", "Emma|FIT"] and the input to the method is "FIT" then the method must return 2.

1m) Develop the main method that creates an instance of the university class, adds students and faculty, adds enrollments, and tests the method 'countStudentsFaculty'.

image text in transcribed

INSTANCE VARIABLE DESCRIPTION EXAMPLE university Name at least 3 characters Monash,RMIT worldRank a positive non-zero integer 1,304,57 faculties An ArrayList of strings that represents the list of faculties. The minimum length of each string is 3 characters. ["FIT","LAW"] students An ArrayList of strings, where each string represents a student name. ["John,"Tim,"Emma,"Sally"] The minimum length of each string is 2 characters. enrollment An ArrayList of strings, where each string must have two segments separate by l. The first segment represents the student name and the second segment represents the faculty ["John|FIT,Tim Law,Emma FIT] name

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions