title: pseudocode input age, calculate max and average for java
body: <p>Write a pseudo code algorithm which will input a series of people's
  ages (as integers between 1 and 120 inclusive) and calculate the maximum and average
  age. The average age should be calculated as a real number. Your algorithm should
  continue to input age values until the user inputs a value of zero. This is a signal for the
  algorithm to stop inputting the age, and to then output the average and maximum ages. If
  the user enters an age that is invalid then your algorithm should continue to re-prompt the
  user until they enter a valid age. Your algorithm should make good use of sub modules.
  Note zero should not be included when determining the average or maximum age.</p>
  
  <p>this is my practice question</p>
  
  <p>i have come up with</p>
  
  <pre><code>main 
  
  FOR 
  age = inputAge &lt;-prompt "enter age"
  max = getMax &lt;- age
  sum = sum + age
  average = getAverage &lt;- sum, number of times input
  END FOR
  OUTPUT max, average
  
  END MAIN
  
  METHOD inputAge
  IMPORT prompt
  EXPORT age
      INPUT age
      WHILE age &gt;= 120 AND age &lt;= 0 DO
          OUTPUT "enter valid age"
          INPUT age
  
      END WHILE 
  END 
  
  METHOD getMax
  IMPORT age
  EXPORT max
      IF max &lt; 0 THEN
      max = age
  END
  
  METHOD getAverage
  IMPORT sum, number of times input
  EXPORT average
      average = sum / number of times input
  END
  </code></pre>
  
  <p>my problem is that im not quite sure how to input 1 to 120 and stop loop when 0 is input and getting number of times input so i can calculate the average. the for loop in the main is also a problem. i get what the question is asking but its just not getting together in my head. could i get help with this question?</p>