Question: QUESTION: JAVA CODE ONLY package con,entities; public abstract class Person { private String firstName; private String lastWane; public Person(String firstName, String lastNane) f this. firstNane

 QUESTION: JAVA CODE ONLY package con,entities; public abstract class Person \{private String firstName; private String lastWane; public Person(String firstName, String lastNane) fthis. firstNane = firstName; this. lastName = lastNane; 3 public string getFirstwame()\{ return firstName; \} public void setFirstName(string firstName) \{ this. firstrane -firstwane; ) public string getlastNane() ( return lastllame; ] public void setlast

QUESTION: JAVA CODE ONLY

Nane (String lastlane) \{ this. Iesthane - 1osthame; \}. package com.entities; public

enum StudentYear \{ FRESHMAN, SOPHMORE, JUNIOR, SENTOR packigge com, ortitles; mblic class

Student extends Person' private double tuition; private studentyear studentYoar; public student(String firstwane,

package con,entities; public abstract class Person \{ private String firstName; private String lastWane; public Person(String firstName, String lastNane) f this. firstNane = firstName; this. lastName = lastNane; 3 public string getFirstwame() \{ return firstName; \} public void setFirstName(string firstName) \{ this. firstrane - firstwane; ) public string getlastNane() ( return lastllame; ] public void setlast Nane (String lastlane) \{ this. Iesthane - 1osthame; \}. package com.entities; public enum StudentYear \{ FRESHMAN, SOPHMORE, JUNIOR, SENTOR packigge com, ortitles; mblic class Student extends Person' private double tuition; private studentyear studentYoar; public student(String firstwane, String lasthane, Studentraar studentrear, double tuition) i super (tirstiane, LastNane): this studentrear - studentyear: this. tuition = tuitiong ) public studentYear getstudentYear ( ) \{ retarn this.studentYear; ? public void setstudentYesr (StudentYesr studentYear) \& thas.studentYear = studentYear; ) pubilic deuble gotTuition() \& retion tultion; i) pelblic void setTuition(double tuition) ( this, tudtion - tuitieng J Moverride poblic string tostring() \{ return Student Year: 4 studenthear +, tuition +tuition; package con.entities; public class Professor extends Person\{ private String[] subjectsTaught; public Professor(String firstNome, String lastWame, String[] subjectTaught) \{ super (firstNane, last Name); this. subjectsTaught = subject Taught; ) public string[] getsubjectsTaught( ) \{ return subjectstaught; ) public void setsubjectsTaught(String subjectsTaught[]) \{ this. subjectstaught = subjectsTaught; 3 goverride public string tostring() f return "Subjects Taught: " + subjectsTaught; nenysa 4 stuoentre package com-entities; Inport java,ut11. Arraytist; import jovo.util. Arrays; public class StudentDeno \{ poblic static void eain(String[] args) \{ Student[] students - new Student[5]: students[e] - new Student ("Hob*, "Sith", StudentYear. FRFsiecev, 100e0); students[1] - new Student("Sue", "Stom", StudentYear, JnoroR, 12ee9); students[2] = new Student ("Andy", "Johnson", Studeatrear. FREsiwev, 9eee); students[3] - new Student ("Richard", "Reeds", StudentYear. JumroR, 15000); students [4]= nes Student ("B11], "Howards", StudentYear. Sopenose, 11000); Professor[] professors = new Protessor[5]; String[] subjects - \{ "us Mistory", "Calculus", Norld Wistory" ); professors [] = new Profestor ("Charles", "Xavder", subjects); String[] subjects2 - \{ World Kistory": "Psychology };: professors [1] = new Professor("Nick", "rury", subjects2); String[] subjects3- \{ "Calculus", "Algebra"); professors [2] = nes, Professor("Jean", "Grey", subjects3); String[] subjects4 - ( "Intro to Law", "Lha II, "World History "); professors[3] - hes Professor ("Mate", "Wurdock", subjects4); String[] subjects5 - \{ "Artificiol Intelligence", "Hetaphysics", "Calculus"]; professers [4] = new Professor("Eruce", "Banner", subjects5); double newcost= Personut11ities. Ineneasetuition (stidents [1],16); System,out.printlnn(newcost+ should equal tidudents[2].getTultion ()+1n2); Studeat[] freshran = Personutilitles. getstudentayVear (students, StudentYear. FREsWewV); Systen.out.printlin(-Freshnan Students: " Arrays, tostring(freshman)); Student[] studeat1 - PersonUtilities.getStudentbyYear(students, StudentYear. JukraR); Systen.out. printin("Junion Students1 + Arrays, tostring(student1)); Create a class called PersonUtilities in the com,utilities package. You will be writing three methods total! If you want to add private methods to simplify your code, you can do so. Code for testing all three methods can be found in the Demo dass (shown above). The class outline is below. Ift com.utilities C PersonUtilities 5 increaseTuition(Student, int) : double getStudentsBy Year(Student[], StudentYear) : Student[] findProfessorsWhoTeach(Professor[L String) : ArrayList METHOD DNE Method increaseTuition will take one Student object and an int. The int represents the percentage out of 100 . Method will update the price of the student's tuition by the percentage and the method will return the updated tuition cost. For example: double newCost = PersonUtilities .increaseTuition(students [1],10); This should increase the tultion cost of students [1] by 10%. The resulting tuition cost will be: 13200.00 If instead, I passed in (students[2], 5), the resulting cost will be: 9450.00. METHOD TWO Method getStudentsByYean will take an arfoy of Student and a StudentYear enum. The method will return an array of students that have match that student year. For example: student[] matches = Personutilities.getstudentsbyrear (students, Studentrear. FRESHMAN); This method should return an array with two students: Bob smith and Andy lohnson. If I passed in StudentYear JUNIOR, the method would return the following students: Sue Storm and Richard Reeds. METHOD THREE Method findProfessors WhoT each will take an array of Professor and a String containing the subject to look for. The method will return a list of all professors who teach that subject. This search SHOULD NOT AE CASE SENSITIVE. ff Test getstudentssyrear here for fREsreits sruocists ff Test getstudentscy Year here for Jumor sTocNTs If Test f indProfessorskthofeach for morld history" If Test findorofessorskhofeach for cotcutus

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!