2008年4月14日 星期一

Average income by gender




Write a program to calculate average income by gender based on the following data, where F stands for female and M for male.

F 62,000
M 25,000
F 38,000
F 43,000
M 65,000
M 120,000
F 80,000
M 30,100



You should be able to allow users to type in a whole line such as F 80,000 followed by next line M 30,100.

Without any change made to your program, your program should be able to process a new set of data, such as follows:

M 52,000
M 35,000
F 48,000
M 33,000
F 75,000
F 110,000
F 90,000
M 30,100

沒有留言: