Braincode
11th November 2011, 01:24 PM
ane ada assignment soalnya kaya gini gan, ada yg bisa bantu kah
Write a program that tabulates results of an opinion poll on banning smoking in public places.
The results are contained in a file name smoke.dat as below.
1 M
2 F
2 M
3 F
3 F
1 F
2 M
:
:
:
2 F
1 M
Each record consists of:
� a single opinion: 1 indicates �agreed�, 2 for �not agreed�, and 3 for �not sure�.
� gender : 'M' for male, 'F' for female
Your program should read the data into two arrays namely opinion and gender. Then count
the number of each opinion category based on gender type and also calculate the total for each opinion category, each gender type and also the overall total
Then display the results on the screen in the following format:
Opinion Male Female Total
-------------------------------------
Agreed 19 25 44
Not agreed 23 24 47
Not sure 6 5 11
-------------------------------------
Total 48 54 102
agan2 yg dewa2 mohon bantuannya
:ceriwislove:
</div>
Write a program that tabulates results of an opinion poll on banning smoking in public places.
The results are contained in a file name smoke.dat as below.
1 M
2 F
2 M
3 F
3 F
1 F
2 M
:
:
:
2 F
1 M
Each record consists of:
� a single opinion: 1 indicates �agreed�, 2 for �not agreed�, and 3 for �not sure�.
� gender : 'M' for male, 'F' for female
Your program should read the data into two arrays namely opinion and gender. Then count
the number of each opinion category based on gender type and also calculate the total for each opinion category, each gender type and also the overall total
Then display the results on the screen in the following format:
Opinion Male Female Total
-------------------------------------
Agreed 19 25 44
Not agreed 23 24 47
Not sure 6 5 11
-------------------------------------
Total 48 54 102
agan2 yg dewa2 mohon bantuannya
:ceriwislove:
</div>