Question
JAVA GUI- OOP Your code structure will be suitable for object oriented programming. Please don't make the code structure complicated. can you explain the code
JAVA GUI- OOP
Your code structure will be suitable for object oriented programming.
Please don't make the code structure complicated.
can you explain the code you wrote (create comment lines. (explain methods)
This project needs to be done urgently, can you do it immediately? (In about 10 hours) How long can you complete? Can you inform me? Can you write a comment.
Please make sure the code you wrote is correct, Thank you
The codes below may help you.
Provided the source code and sample output as per the requirements of PART A.
Source Code:
Improvement.java:
public interface Improvement{ public String improveMemory(); }
ClinicalCase.java:
public class ClinicalCase { // ClinicalCase instance attributes private String patient_id; private String patient_name; private String patient_surname; private int age; private String gender; /** * Parameterized constructor * @param patient_id * @param patient_name * @param patient_surname * @param age * @param gender */ public ClinicalCase(String patient_id, String patient_name, String patient_surname, int age, String gender) { this.patient_id = patient_id; this.patient_name = patient_name; this.patient_surname = patient_surname; this.age = age; this.gender = gender; } @Override public String toString() { return "Patient id=" + patient_id + " Patient name=" + patient_name + " Patient surname=" + patient_surname + " Age=" + age + " Gender=" + gender; } /** * @return the patient_id */ public String getPatient_id() { return patient_id; } }
MemoryDeficit.java:
public abstract class MemoryDeficit implements Improvement{ public String deficit_id; public String memory_loss; public int totalDeficit; /** * Parameterized constructor * @param deficit_id * @param memory_loss */ public MemoryDeficit(String deficit_id, String memory_loss) { super(); this.deficit_id = deficit_id; this.memory_loss = memory_loss; } @Override public String toString() { return " Deficit_id : " + deficit_id + " Memory_loss=" + memory_loss + " Total Deficit : "+ totalDeficit; } /** * @return the deficit_id */ public String getDeficit_id() { return deficit_id; } /** * @return the totalDeficit */ public int getTotalDeficit() { return totalDeficit; } }
Alzheimer.java:
public class Alzheimer extends MemoryDeficit { // Alzheimer instance variables private String declining_area; private int totalAlzheimer; private ClinicalCase clin; /** * Parameterized constructor * * @param deficit_id * @param memory_loss * @param declining_area * @param patient_id * @param patient_name * @param patient_surname * @param age * @param gender */ public Alzheimer(String deficit_id, String memory_loss, String declining_area, String patient_id, String patient_name, String patient_surname, int age, String gender) { // call super class constructor super(deficit_id, memory_loss); this.declining_area = declining_area; this.clin = new ClinicalCase(patient_id, patient_name, patient_surname, age, gender); } @Override public String toString() { return "Declining_area : " + declining_area + " TotalAlzheimer: " + totalAlzheimer + " Clinical PatientID:" + clin.getPatient_id(); } /** * @return the totalAlzheimer */ public int getTotalAlzheimer() { return totalAlzheimer; } @Override public String improveMemory() { return "Solve Sudoku puzzles"; } }
Amnesia.java:
public class Amnesia extends MemoryDeficit { private String amensia_type; private String cause; private String location; private ClinicalCase clin; private int totalAmnesia; /** * Parameterized constructor * * @param deficit_id * @param memory_loss * @param amensia_type * @param cause * @param location * @param patient_id * @param patient_name * @param patient_surname * @param age * @param gender */ public Amnesia(String deficit_id, String memory_loss, String amensia_type, String cause, String location, String patient_id, String patient_name, String patient_surname, int age, String gender) { // call to super class constructor super(deficit_id, memory_loss); this.amensia_type = amensia_type; this.cause = cause; this.location = location; this.clin = new ClinicalCase(patient_id, patient_name, patient_surname, age, gender); } @Override public String toString() { return "Amensia_type:" + amensia_type + " Cause:" + cause + " Location:" + location + " Clinical PatientID:" + clin.getPatient_id() + " TotalAmnesia: " + totalAmnesia; } /** * @return the totalAmnesia */ public int getTotalAmnesia() { return totalAmnesia; } /** * @param totalAmnesia the totalAmnesia to set */ public void setTotalAmnesia(int totalAmnesia) { this.totalAmnesia = totalAmnesia; } @Override public String improveMemory() { return "Look old Photos"; } }
Info.java:
import java.util.ArrayList; public class InfoClass { // declare an array list of memory deficit ArrayListmemoryArrayList = new ArrayList (); public void addMemory(MemoryDeficit def) { // add memory memoryArrayList.add(def); } public String getAllMemory() { String mem = ""; // iterate over the arraylist for (int counter = 0; counter PART B: Implement your GUI!! Create a frame in your project named as MemoryApp. Frame-1: This frame is the default start up frame. At first, users will enter the id of the deficit and choose the type of the memory loss from the combo box. Then, the user will enter the information of the clinical cases representing the patients. Be careful while entering the name and surname of the patient. Do not forget to separate them by using comma (,) after getting from the user. The deficit type divided into two parts as Amnesia and Alzheimer. Use radio buttons to differentiate them and to open related panels. You may use different number of panels, however do not forget to implement the ones which have the titled border. User cannot edit text areas. Display and search Dimply Dutt Memory Den Deficit id: Memory Loss Clinical Cases Patient Id: Patient Narne, Surname: Age: Gender: Amnesia Akheimer Defioke Type Aogia Total Deficits Case: Brain Location: Add Deficit Search by deficit id: Figure - 1 Figure -2 and 3: Enter the necessary information, choose the radio button "Amnesia in order to enter information about this type of memory deficit. "ADD DEFICIT" button for "Amnesia": When the user presses "ADD DEFICIT button, the information about the memory deficit "Amnesia" must be kept from the necessary components. You will create an Amnesia object with using these information. Then, you will add that object into the InfoClass's ArrayList without creating an InfoClass Object (try to use InfoClass's addMemory method). Also before the add operation ended, all the necessary text fields must be cleared and the combo box values must be appeared as empty just like the opening frame. The added "Amnesia" must be send to the first text area as a message of "Amnesia is added". The value of the "deficit id will be sent to another combo box at the right side of the frame, next to the "Search by deficit id button. > BE CAREFUL; USE ONLY ONE ARRAYLIST which blongs to the InfoClass's static one for holding memory deficit information. DO NOT TRY to separate them into two array lists. Hermyelids Desde Defickt 2353 Desday Deck Memory Herwyluss ici Chicas 15 Pit Peter, Susanne et Priet, 66 ich mesia Total Deficis Retrogate be Caus Brain action Add Daft Figure -2 Figure - 3 Figure -4 and 5: Enter the necessary information; choose the radio button "Alzheimer" in order to enter information about this type of memory deficit. "ADD DEFICIT" button for "Alzheimer": When the user presses "ADD DEFICIT button, the information about the memory deficit Alzheimer" must be kept from the necessary components. You will create an Alzheimer object with using these information. Then, you will add that object into the InfoClass's ArrayList without creating an InfoClass Object (try to use InfoClass's addMemory method). Also before the add operation ended, all the necessary text fields must be cleared and the combo box values must be appeared as empty just like the opening frame. The added Alzheimer" must be send to the first text area as a message of "Alzheimer is added". The value of the "deficit id will be sent to another combo box at the right side of the frame, next to the "Search by deficit id button. Merry Delor's Mer Deich Dick AT Heylesi One Cases Chical Point Patient Sys Dunda Patie, * A Totats Atlete Alfacted Area ABC Search 0.83 23 Figure -4 Figure -5 Figure -6-7: Display Deficit button: in order to display information about the memory deficit types use Display Deficit" button. You are supposed to use InfoClass's getAllMemory() method. Use radio buttons to differentiate the memory deficit types. If the user selects Amnesia radio button and presses the "Display Deficit" button, all the information about this deficit type will be displayed. You are supposed to use InfoClass's static getAmnesia() method to do this. DGTIGRI Memory LORS ) memorLOm011 bent i 45 bent Name: A Patti SERI A Dendar ramal As Type: Rarograde DUS Brain Infection Location: hippocampus Am Total De DOD Acer Figure -6 If the user selects Alzheimer" radio button and presses the "Display Deficit" button, all the information about this deficit type will be displayed. You are supposed to use InfoClass's static getAlzheimer() method to do this. Be careful, "display deficit" button will display all the amnesia information or all the Alzheimer information hold in the array list. Momory Dolicito Derici Id: Display and Search Dirty Det Merry LENI Cles CERE Patient is Pation Name Surnamo! Age DorioitID: 4664 Memory Loss: implicit Fatient id: 55 Patient Name: Zeynep ratiunt Surname Dum Declining AP Goanition Amnesia - Alzheimor Dorot T Alzheimer Total Delicito ArTected Area: Acid Deficit Soaren by cortoit id Figure - 7 Figure - 8: Total Deficits button: When the user presses Total Deficits" button, in the second text area the information about the total numbers of Total Deficits, Total Amnesics" and "Total Alzheimers" will be appeared. You are supposed to use InfoClass's showTotalMemory() method which calls the MemoryDeficit class's static method of getTotalDeficit(). If you need similar static methods for the other total values, add them too. Since, we just entered two information, the number of Total Deficits" is 2, "Total Amnesics" is 1 and the number of "Total Alzheimers" is 1. For every added memory deficit whether "Amnesia" or "Alzheimer, the values here must be increment. Display and Search Display Delicit Memory Deficits Daficht Id: Memory Loss: Clinical Care Patient Id: Patient Name, Surnames DentID: 4064 Memory Losa implicit Patient id: 65 Patient Name: Zeynep Patient Surname: Daria Age Tu Gencler: female Declining Area:cognition Gender: O Amnesia O Alzheimer Deficit Type Alzheimer Total Deficit Afected Are Total Deficits: 2 Total Amnesies: 1 Total Alzheimers: 1 KI Ack Dericit arch tay with Figure - 8 Figure -9-10: Search by deficit id button: The users can search both memory deficit types by using the deficit ids. Your search process will be done by InfoClass's static method of search Memory() which requires a string id as a parameter. When the user selects an id from the combo box and presses the Search by deficit id button, the information about that deficit, should appear in the text area. Display and Search Display Derick Memory Deficits Deficit let: Memory Loss Clinical Cases Patient id Patient Name, Surname: Pericit ID: 2353 Memory Loss: implicit Patient id: 45 Patent NOMO: Ayse Patient Burname: Vali Age: 50 Gender: Female annesie Type: Retrograde Cause: Brain infection Location: hippocampus Age: Gender: Amnesia Alzheimer Deficit Type: Amnesia type Total Deficits Course Total Deficits: 2 Total Amnesis: 1 Total Alzheimara: 1 Brain Location: Select from the combo box and search!! 22:33 Add Deficit Search by detid: Deficit ID: 2363 Memory Loss Implicit Patient id: 45 Patient Name: a Patient Sumame voli Age: 5 Gender ramala Amnesia Type Petrograde V1 Figure - 9 Display and Search Display Deficit Memory Deficits Dericit : Memory Loss: Clinical Cases Patient id: Patient Name, Surname: pencil D: 2353 Memory Loss Impilelt Fallent id: 45 Fatient Name: Ayee Patient Surname: Veli Age 65 Gender: female Amnesia Type: Retrograda Cause Brain Infection Location: hippocampus Age: Gender: Amnesia Alzheimer Deficit Type: Amnesia type: Total Deficit Cause: Total Deficits: 2 Total Amnesica: 1 Total Alzheimers: 1 Brain Location: -1564 Add Deficit Search by deficit perlelt ID: 4554 Memory Loss: implicit Patient id: 60 Patient Nome Zeynep Patient Surname Damia Age: 70 Bender: female Declining Area: Cognition Figure - 10 PART C: Implement Multiple Frame work Try to separate your display section into another frame in a new application, please see the below figures: Memory Application Memory Deficits Deficit Id: Memory Loss Clinical Cases + Patientid Patient Name Surname: DisplayFrame Display and Search Panel Display Amnesia Info Display Alzheimer Info Age Improve Memory Total Deficits Gender Amnesia Alzheimer Search Deficit 123 Deficit Type: Alzheimer Arte cted Area: Add Deficit Display Memory Deficit added to the system There is only Alzheimer Info in the system Deficit ID: 123 Memory Loss: Explicit Patient id: 111 Patient Name: Evren Patient Surname: Aykac Age: 30 Gender: Male Declining Area: Cognition Close Frame Close Frame Figure 11 - 12 Whenever user clicks on Display button a new frame called DisplayFrame appears. To do this; add another Jframe form into your default package. And add two setter method to your display frame. One of them is to set text area of the display frame and the other is for setting the display frame's combo box
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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