Design Example
Average Income by Gender

Problem: you've been hired by a law firm that is working on a sex discrimination case. You are provided a list of incomes for the company, which are labeled M or F. You are asked to compute the average income for females and the average income for males.

Input: a character F or M followed by a floating point salary amount. There is a space between the character and the number, and the input is terminated by a -1 for salary.

Output:


1.  do initializations 
2.  get input for first employee
3.  while not at end of data
4.	output the data that was input 
5.	if is male data 
6.		add 1 to malecount
7.		add salary to malesalaries
	else
8.		add 1 to femalecount
9.		add salary to femalesalaries
10.	get input for next employee
      endloop

11. if malecount is not zero
	average male salary = malesalaries / malecount
12. if femalecount is not zero
	average female salary = femalesalaries / femalecount

13. output malecount, femalecount
14. output average male salary, average female salary

some more detail for some steps

1.1  set malecount, femalecount to 0, set malesalaries, femalesalaries to 0
3.1  while salary is not -1