0

I'm stuck at the moment on a problem, I'm trying to add data separately to all objects in an array list.

eg. Daily, I want to be able to add how much medication each patient has taken to their record in the arraylist. Each patient has a unique identifier which is whats in the arraylist.

I was wondering using JOptionPane is it possible to pull up each patient separately, so that after one is entered the next shows up to enter in information and how would I go about doing it?

Thanks!

1 Answer 1

1

Pseduo code of the data structure might be as following :

class Patient{

   String patientId;
   List<Medication> list;

   public addMedication(Medication med){
      list.add(med); 
   }

}

class Medication{
   String name;
   ...
}



class PatientManager{

   Map<String,Patient> map;

   public addMedication(String patientId,Medication med){
      map.get(patientId).addMedication(med);

   }

}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.