title: Name and age application with specific output using arrays and output
body: <p>For my university lab work we have to finish 4 tasks. I'm currently on 6 of 9 and have for the most part completed it, but I'm having difficulty in completing the final parts of it. This is the description of what we must do:</p>
  
  <blockquote>
    <p>Write a   program that    defines two arrays  -   one of  strings and one of  integers,   both    of  size    10. 
    Your    program should  then    ask the user    to  enter   the a   string  representing    a   persons name,<br>
    and an  integer representing    their   age.    It  should  continue    to  do  this    until   either  the <strong>user<br>
    enters  ‘done’</strong> instead    of  a   name,   or  until   the array   is  full    (that   is, 10  pairs   of  names   and ages<br>
    have    been    entered).   It  should  then    print   out the names   and ages    <strong>as    well    as  the names   of  the 
    youngest    and oldest.</strong>   </p>
    
    <p>Hint: One tricky  part    is  making  sure    that    once    you’ve  typed   ‘done’  to  Finish  entering    names,<br>
    your    program does    not then    ask you for the age of  the person  with    name    ‘done’  -   be  careful 
    about   this.</p>
  </blockquote>
  
  <p>I've highlighted the issues I'm having above in bolded text. Below is the code I currently have, but I'm not sure how to properly accomplish the bolded text.</p>
  
  <pre><code>import java.util.Scanner;
  import java.util.Arrays;
  import java.util.Collections;
  
  public class nameAge {
  
  
  public static void main(String[] args){
   String[] name = new String[10];
  
       int[] age = new int[10];
  
      Scanner in = new Scanner(System.in);
  
      String NAME_REQUEST = ("Please enter name");
      String AGE_REQUEST = ("Please enter age");
  
      System.out.println("Please enter the name of a person and then their age. Do this for up to 10 people and once finished, type 'done'");
      name[0] = in.nextLine();
      System.out.println(AGE_REQUEST);
      age[0] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[1] = in.next();
      System.out.println(AGE_REQUEST);
      age[1] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[2] = in.next();
      System.out.println(AGE_REQUEST);
      age[2] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[3] = in.next();
      System.out.println(AGE_REQUEST);
      age[3] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[4] = in.next();
      System.out.println(AGE_REQUEST);
      age[4] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[5] = in.next();
      System.out.println(AGE_REQUEST);
      age[5] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[6] = in.next();
      System.out.println(AGE_REQUEST);
      age[6] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[7] = in.next();
      System.out.println(AGE_REQUEST);
      age[7] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[8] = in.next();
      System.out.println(AGE_REQUEST);
      age[8] = in.nextInt();
      System.out.println(NAME_REQUEST);
      name[9]= in.next();
      System.out.println(AGE_REQUEST);
      age[9] = in.nextInt();
      System.out.println(NAME_REQUEST);
  
  
      int size = name.length;
      int sizeN = age.length;
  
      for (int i=0; i &lt; size; i++) {
          System.out.println("Name: " + name[i]);
          System.out.println("Age: " + age[i]);
      }
      int smallest = age[0];
      int largetst = age[0];
      for(int i=1; i&lt; age.length; i++)
              {
                      if(age[i] &gt; largetst)
                              largetst = age[i];
                      else if (age[i] &lt; smallest)
                              smallest = age[i];
  
              }
  
              System.out.println("Largest Number is : " + largetst);
              System.out.println("Smallest Number is : " + smallest);
      }
  }
  </code></pre>