Voter Tally
Citizens in a nearby county recently voted whether or not to approve a bond referendum to finance the construction of a new school. The first five results of that vote are contained in the file votes.dat.
Write a program that reads the file votes.dat. The program should summarize the voting data to include a total tally of “yes” and “no” votes as well as a break-down of votes based on the voter’s district.
For example, a sample votes.dat file might contain the data shown below. The first value within a line is the voter’s district (1-3). The second value within a line indicates whether the voter approved (Y) or disapproved (N) of the measure. Remember, you may quickly make a data file using any text editor such as Windows Notepad. Note: If/Else statements should only be used in this assignment. Not While loops (that's the next chapter/lesson 5).
1 Y 2 N 1 Y 1 N 3 Y
I don't know what I'm doing. I need to use if/else. Help please. I got set back big time bc of the hurricane and my teacher is unkind.
Aucun commentaire:
Enregistrer un commentaire