please help!!! HW1 Part 1 (Patient and Physician) The problem: You are given a java class (Test) that includes the main(

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

please help!!! HW1 Part 1 (Patient and Physician) The problem: You are given a java class (Test) that includes the main(

Post by answerhappygod »

please help!!!
HW1
Part 1 (Patient and Physician)
The problem:
You are given a java class (Test) that includes the main() method. You are also given the expected output when the program is executed.
You have to test your program using this test program. Do not change the test program.
Your task is to write the Person, Physician, and Patient classes.Add at least two more Persons to the array persons, and test run.
5:56 Back package hospital; public class Patient extends Person String insurance; public Patient(String name, int age, String insurance){ HW1.docx super(name, age); this.insurance insurance; 1 package hospital; } @Override public String toString()){ return String format(// fill this ????) } public class Physician extends Person String speciality; Dashboard speciality){ public Physician(String name, int age, String super(name, age); this speciality - speciality: } @Override public String toString(): Il fill this ???? Part-2 (8-puzzle moves) Consider the 8-Puzzle game for this part. 8 Puzzle (from Wikipedia) The problem. The 8-puzzle problem is a puzzle invented and popularized by Noyes Palmer Chapman in the 1870s. It is played on a 3-by-3 grid with 8 square blocks labeled 1 through 8 and a blank square. Your goal is to rearrange the blocks so that they are D Notifications Calendar E To Do A Inbox
5:56 < Back Comparable { protected String name: protected int age; public Person(String name, int age){ this.name = name; this.age-age: 1 public int age(){ return age; Dashboard Calendar To Do D Notifications Inbox
5:56 < Back HW1 Part 1 (Patient and Physician) The problem: HW1.docx You are given a java class (Test) that includes the main() method. You are also given the expected output when the program is executed. You have to test your program using this test program. Do not change the test program. Your task is to write the Person, Physician, and Patient classes. Add at least two more Persons to the array persons, and test run. Test Class package hospital; import java.util.Arrays; public class Test{ private static void display(Person[] persons) for (Person person persons) System.out.println(person); public static void main(String[] args) { Person[] persons = new Person[4]; persons[0]= new Patient("Mary", 35, "BCBS"); persons[1]- new Physician("Rex", 40, "Cardio"); persons[2] = new Patient("Jury", 30, "XAM"); persons[3] = new Physician("Sam", 25, "Ortho"); //include at least two other persons System.out.println("Before sorting...\n"); display(persons); Arrays.sort(persons); System.out.println("After sorting...\n"); display (persons); } Example Output: Note that, all the persons are sorted based on their age (after sorting) Before Sorting .... PATIENT'S NAME: Mary Age: 35 Insurance: BCBS Dashboard Calendar To Do D Notifications û Inbox
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply