• Post Reply Bookmark Topic Watch Topic
  • New Topic

help me please,please give the program

 
asha paruchuri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scenario
In preparation for the 2004 Presidential election, the company you work for, Good Programming, Inc (GPI), has been asked to design a centralized system for recording and tallying votes. GPI has plans for users to be able to connect to the voting system via the Internet, validate their identity, and cast their votes on local or national issues. As a recently hired programmer, you have been assigned to write a program that can be used to detect voting fraud.

Assignment
Your program will read three files. The file named voter.dat contains information about voters, one voter per record. The file named votes.dat contains information about how voters voted on different issues, one record per vote. The file named deaths.dat contains information about voters who have died, one record per voter who has died. See below for the file format for each file.
Your program must process each voter in the voter.dat file. Processing a voter means checking for possible voting fraud. Voting fraud is defined as any of the following cases:
A voter has voting records dated after that person died.
A voter has multiple voting records for the same issue.
Votes exist from a voter who doesn't exist.
If your program finds a case of possible voting fraud, you must output a message to the file named fraud.dat with enough information for an investigator to look into the possible fraud.
You may assume that each file is in the correct format. However, there are various logical errors that you must identify and test against. For example, one logical error would be if the program was run and the voters.dat file did not exist. Your test plan must cover all the logical errors.
Since there will be a large number of people voting in the next presidential election, your manager is concerned about the efficiency of your program. To be as efficient as possible, your program should read each record from the data files only once.

voter.dat file format
The voter.dat file contains information about the voters, one voter per line. The lines in the file are in ascending order by voter id.
id:name:address
id - This is a voter id, a number greater than 0.
name - This is the full name of the voter.
address - This is the voter's address.

votes.dat file format
The votes.dat file contains information about the votes, one vote per line. The lines in the file are in ascending order by voter id. There may be more than one vote per voter id. For a single voter, the lines are in ascending order by issue number.
id:issue ate:vote
id - This is a voter id. This id may or may not be in the voter.dat file.
issue - This is the number of the issue being voted on. It is a positive number.
date - This is the date of the vote, in MM/DD/YYYY format.
vote - This is the vote cast for this issue. It may be one of the following: Y (a value of Y indicates a vote for the issue) or N (a value of N indicates a vote against the issue).

deaths.dat format
The deaths.dat file contains information about voters who have died, one voter per line. The lines in the file are in ascending order by voter id.
id ate:cause
id - This is a voter id. This id may or may not be in the voter.dat file.
date - This is the date of the voter's death, in MMDDYYYY format.
cause - This is a description of how the voter died.

Example data files:
voter.dat
1:Jay Shaffstall:999 Franklin St, Columbus, OH 43221
2:Lisa Olinger:888 Sunny Vale, Columbus, OH 43221
3 octor Smith:333 Lost St, Columbus, OH 43221
votes.dat
2:1:11/08/2000:Y
2:2:11/08/2000:Y
2:2:11/08/2000:N
3:3:11/08/2000:Y
4:5:11/08/2000:Y
deaths.dat
3:05281999:Natural causes
fraud.dat
Voter ID: 2 Name: Lisa Olinger
extra vote on issue 2
Voter ID: 3 Name: Doctor Smith
voted on issue 3 after dying on 05/28/1999 of natural causes
Voter ID: 4 does not exist in voter file
voted on issue 1
An example
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will refer you to my previous answer. What are you going to do if you get a job in this field? Keep coming back and hoping we keep providing you with code? Do some work on your own and prove you are worthy of our valuable time. We will be glad to answer any questions you may have. Again, I STRONGLY suggest you speak with your instructor.
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to ask the moderators to close the thread in applets.
Asha, welcome to the Ranch, but you're off to a bad start.
First, no one at the Ranch is going to do your homework for you, especially if you haven't even tried it yourself. If you post code to show that you are attempting to do the work YOU were meant to do, then maybe you will get some help. Asking people to give you a program is not going to get you anywhere.
Second, posting the same question in multiple forums is a big no-no. It wastes the moderators' time, and that is something that isn't looked favorably upon.
Thank you Joe for your response to both ( :roll: ) of his posts.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!