Do Project 7 of Chap. 3. (2nd ed. & 3rd ed.) or Project 4 (1st ed.) Hint: You don't have to use nested loops.
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
沒有留言:
張貼留言