title: how do i make an appointment record in java?
body: <p>Ok so basically i have to make an appointment record of doctors and patients. I have already made records of doctors and patients but now i have to make an appointment record in which i have to assign one patient to  a doctor based on the patient's illness and the doctor's specialization. I am new to java so i am not so good at it so if you can help me out, i will highly appreciate that :-) i will show u the coding i did so far. It contains some extra stuff in it as well but i have to add it in it for my assignment. And yea, the names i gave to some variables and objects are sort of weird but that is cos java wont let me give them a proper and appropriate name.. Anyways here is my coding :- </p>
  
  <pre><code>package samplee.java;
  import java.util.*;
  import java.util.ArrayList;
  import java.util.Scanner;
  
  public class patient$ {
  
      public static void main(String[] args) {
          ArrayList&lt;patientss&gt; patient1= new ArrayList&lt;patientss&gt;();
          ArrayList&lt;doctorss&gt; doctor1= new ArrayList&lt;doctorss&gt;();
          Scanner src= new Scanner(System.in);
          Scanner sc= new Scanner(System.in);
          Scanner stc= new Scanner(System.in);
          Scanner sdc= new Scanner(System.in);
          Scanner update= new Scanner(System.in);
          Scanner ill=new Scanner(System.in);
          int id,it,num,i,docid,docit,docnum,docid1;
          String name,docname,docspecial,illness;
          int ages,docage;
          int id1;
          Boolean leave = false;
          while(!leave){
              patientss xx= new patientss();
              System.out.println("Enter the patient's ID ");
              System.out.println("-1 to finish entering");
              id=src.nextInt();
              if(id != -1){
              xx.setId(id);
  
          } 
              System.out.println("Enter the patient's name ");
          System.out.println("-1 to finish entering");
          name=stc.next();
          if(id != -1){
              xx.setName(name);
              patient1.add(xx);
          } 
          System.out.println("Enter the patient's phone number");
          System.out.println("-1 to finish entering");
          num=sdc.nextInt();
          if(id != -1){
              xx.setNum(num);
              patient1.add(xx);
          } 
          System.out.println("Enter the type of illness the patient has");
          System.out.println("-1 to finish entering");
          illness=ill.next();
          if(id!= -1){
              xx.setIllness(illness);
              patient1.add(xx);
          }
  
              else { leave = true; }//Escape the while loop.
          }
          System.out.println("Enter the id of a patient");
          it=sc.nextInt();
          patientss tt= new patientss();
          for(i=0;i&lt;patient1.size();i++)
              {
              tt=patient1.get(i);
              if(it==tt.getId()) 
              System.out.println(tt.toString());
              break;
              }
          System.out.println("Enter the id of the patient you want to update");
          Scanner id11= new Scanner(System.in);
          id1=id11.nextInt();
          int up,id2;
          String namess;
          int phones;
          patientss dd= new patientss();
          for(i=0;i&lt;patient1.size();i++){
              dd=patient1.get(i);
              if(id1==dd.getId()){
                  System.out.println("If you want to change the name, type 2");
                  System.out.println("If you want to change the number, type 3");
                  System.out.println("If you want to change the id, type 1");
                  up=update.nextInt();
                  if(up==1){
                      System.out.println("Enter a new ID ");
                      Scanner idd= new Scanner(System.in);
                      id2=idd.nextInt();
                      dd.setId(id2);
                      patient1.add(dd);
  
              }
                  else if(up==2){
                      System.out.println("Enter a new name");
                      Scanner namme=new Scanner(System.in);
                      namess=namme.next();
                      dd.setName(namess);
                      patient1.add(dd);
  
                  }
                  else if(up==3){
                      System.out.println("Enter a new phone");
                      Scanner newphone= new Scanner(System.in);
                      phones=newphone.nextInt();
                      dd.setNum(phones);
                      patient1.add(dd);
  
                  }
          }
              System.out.println(dd);
              break;
          } 
          boolean over = false;
          while(!over){
              doctorss xt= new doctorss();
              System.out.println("Enter the doctor's ID ");
              System.out.println("-1 to finish entering");
              docid=src.nextInt();
              if(docid != -1){
              xt.setDocid(docid);
              }
              System.out.println("Enter the doctor's name ");
              System.out.println("-1 to finish entering");
              docname=stc.next();
              if(docid != -1){
                  xt.setDocname(docname);
                  doctor1.add(xt);
              } 
              System.out.println("Enter the doctor's phone number");
              System.out.println("-1 to finish entering");
              docnum=sdc.nextInt();
              if(docid != -1){
                  xt.setDocnum(docnum);
                  doctor1.add(xt);
              }
              System.out.println("What does the doctor specialize in?");
              String specialize;
              Scanner special= new Scanner(System.in);
              specialize=special.next();
              if(docid != -1){
                  xt.setSpecialize(specialize);
                  doctor1.add(xt);
              }
                  else { over = true; }//Escape the while loop.
              }
          System.out.println("Enter the id of a doctor");
          docit=sc.nextInt();
          doctorss tti= new doctorss();
          for(i=0;i&lt;doctor1.size();i++){
              tti=doctor1.get(i);
              if(docit==tti.getDocid()) 
              System.out.println(tti.toString());
              }
  
          } 
      }
  </code></pre>
  
  <p>and these r my classes..</p>
  
  <pre><code>package samplee.java;
  
  public class patientss {
  int id;
  String name;
  int num;
  String illness;
  public String getIllness() {
      return illness;
  }
  
  public void setIllness(String illness) {
      this.illness = illness;
  }
  
  public int getNum() {
      return num;
  }
  
  public void setNum(int num) {
      this.num = num;
  }
  
  public String getName() {
      return name;
  }
  
  public void setName(String name) {
      this.name = name;
  }
  
  public int getId() {
      return id;
  }
  
  public void setId(int id) {
      this.id = id;
  }
  public String toString(){
      return name+" "+id+" "+num+ " "+illness;
  }
  }
  </code></pre>
  
  <p>and here is my doctor's class:-</p>
  
  <pre><code>package samplee.java;
  
  public class doctorss {
  int docid;
  String specialize;
  public String getSpecialize() {
      return specialize;
  }
  public void setSpecialize(String specialize) {
      this.specialize = specialize;
  }
  public int getDocid() {
      return docid;
  }
  public void setDocid(int docid) {
      this.docid = docid;
  }
  public String getDocname() {
      return docname;
  }
  public void setDocname(String docname) {
      this.docname = docname;
  }
  public int getDocnum() {
      return docnum;
  }
  public void setDocnum(int docnum) {
      this.docnum = docnum;
  }
  String docname;
  int docnum;
  public String toString(){
      return docname+" "+docid+" and "+docnum+" he specializes in"+specialize;
  }
  }
  </code></pre>