Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
public class Lab 7 { public static String arrayResult ( int [ ] [ ] array ) { return ; } public static
public class Lab public static String arrayResultint array return ; public static boolean magicSquareint array return false; class Patient class Physician Lab Requirements You will be graded not only by JUnit tests given to you, but also additional tests covering some other input values. This is to encourage you to take more responsibility for the correctness of your code, by writing your own tests. Also, your lab submission will not be graded manually using the console application given to you. For the JUnit test class LabTest.java given to you: Do not modify the test methods given to you. You are allowed to add new test methods. For each method in the Lab class that you are assigned to implement: No System.out.println statements should appear in each of the utility method. No Scanner operations eg input.nextInt should appear in each of the utility method. Instead, refer to the input parameters of the method. It is strictly forbidden for you to use any library class other than the ones discussed in class eg ArrayList Your grade will be reduced by Task : PatientPhysician Classes You are required to write a program fot a clinie's physicians. Your first tissk is to creale a class called Patient. A potient has a name, sovial security number, age, gender. and addreis. The class should have as comstructors: Patient :consiructor that sets the attributes to their defailt values. Patient String maane, Striag ssn int age, char gender, String address: constructor to initalize the attributes of a patient obyect with the parameter values passed to the constructor: Public Methods: Setten and getters for all the attributes String taString : returns the string representation of a Patient obyect as follows: "Patient Name: mame it SSN: ssin it Age: age it Gender, gender t Addreso. address" You also have to create a class Physician. A physician has i name, phonc, and a list of paticats. A physiciaa can have a maximum number of patients initially. Also, the class kecps track of the number of patients of each physicutin. The class should have two constructors: Physician a the defiult constructor with no parameters. Physician String name, String phone: constructor to mitislize the attributes name and phone of a Playsseaar with the parameter values passed to the constructor. Puhlic Methods: Setters and getters for all the attributes admitpatient Patient patient: this method adds a patient to the physician's hist. In case the physician has reached his maximum number of patients, the method should increase the size of his patient's array and adds the new patient. To increase the length of the array, there should be a call to a private method increaseLength increasel.ength : this is a method to increase the length of the array by doubling its current length. releasePatient Patient patient: this method takes a pataent object and removes this object from the list of patients of the physaciam. A patient is searched for based on their SSN If no patient in the antray matches the patient parameter, the operation should be simply ignored. patientsRepert : this method reports all the potients of the physiciam. It returns a string that includes the patients infonmation of the array patients: "Tahent Nanse tame it SSN; san it Age: age it Gender: gender it Address: address in "Patient Names name it SSN; sin it Age: age is Gender: gender t Address: address n "Patient Name: name is SSN: asn t Ages age if Gender: gender it Address: address n Some of the delails about the claswes altribater, methods, and parameters should be deduced froat the text cases wnitten for you in test the clarses.
public class Lab public static String arrayResultint array return ; public static boolean magicSquareint array return false; class Patient class Physician Lab Requirements You will be graded not only by JUnit tests given to you, but also additional tests covering some other input values. This is to encourage you to take more responsibility for the correctness of your code, by writing your own tests. Also, your lab submission will not be graded manually using the console application given to you. For the JUnit test class LabTest.java given to you: Do not modify the test methods given to you. You are allowed to add new test methods. For each method in the Lab class that you are assigned to implement: No System.out.println statements should appear in each of the utility method. No Scanner operations eg input.nextInt should appear in each of the utility method. Instead, refer to the input parameters of the method. It is strictly forbidden for you to use any library class other than the ones discussed in class eg ArrayList Your grade will be reduced by Task : PatientPhysician Classes You are required to write a program fot a clinie's physicians. Your first tissk is to creale a class called Patient. A potient has a name, sovial security number, age, gender. and addreis. The class should have as comstructors: Patient :consiructor that sets the attributes to their defailt values. Patient String maane, Striag ssn int age, char gender, String address: constructor to initalize the attributes of a patient obyect with the parameter values passed to the constructor: Public Methods: Setten and getters for all the attributes String taString : returns the string representation of a Patient obyect as follows: "Patient Name: mame it SSN: ssin it Age: age it Gender, gender t Addreso. address" You also have to create a class Physician. A physician has i name, phonc, and a list of paticats. A physiciaa can have a maximum number of patients initially. Also, the class kecps track of the number of patients of each physicutin. The class should have two constructors: Physician a the defiult constructor with no parameters. Physician String name, String phone: constructor to mitislize the attributes name and phone of a Playsseaar with the parameter values passed to the constructor. Puhlic Methods: Setters and getters for all the attributes admitpatient Patient patient: this method adds a patient to the physician's hist. In case the physician has reached his maximum number of patients, the method should increase the size of his patient's array and adds the new patient. To increase the length of the array, there should be a call to a private method increaseLength increasel.ength : this is a method to increase the length of the array by doubling its current length. releasePatient Patient patient: this method takes a pataent object and removes this object from the list of patients of the physaciam. A patient is searched for based on their SSN If no patient in the antray matches the patient parameter, the operation should be simply ignored. patientsRepert : this method reports all the potients of the physiciam. It returns a string that includes the patients infonmation of the array patients: "Tahent Nanse tame it SSN; san it Age: age it Gender: gender it Address: address in "Patient Names name it SSN; sin it Age: age is Gender: gender t Address: address n "Patient Name: name is SSN: asn t Ages age if Gender: gender it Address: address n Some of the delails about the claswes altribater, methods, and parameters should be deduced froat the text cases wnitten for you in test the clarses.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started