Well I have a question and not sure if it's right. Here's the question(Long one).
Applications. Build a class called Precinct. The record for a voter will consist of aname (String) and a political party(Boolean)(Two party). The SignInQueue method takes two parameters, a voter name and a party, and places this voter in a queue of those waiting to sign in. This SignInComplete method removes the voter at the front of the sign-in queue and places that voter into either the queue waiting to vote for the true party or the queue waiting to vote for the false party, depending on the voter's party. The TrueDone method removes the voter from the queue waiting to vote for the true party and returns the name of the voter. THe FalseDone method removes the voter from the queue waiting to vote for the false party and returns the name of that voter.
I have to start this from scratch, and well I finished it, and wanted to see if my methods were right Here is my code:
public class Precinct
{
private static class Record
{
Public String Name;
Public Boolean Party;
Public Record(String voter, Boolean Group)
{
Name = voter;
Party = Group;
}
Public Record(Record Item)
{
Name = Item.Name;
Party = Item.Party;
}
}
public void SignInQueue(String Name, Boolean Party)
{
Record A = new Record(Name, Party)
WaitingSignIn.Store(A); //This is where the voter will be in queue
}
public void SignInComplete()
{
Record A = WaitingSignIn.Retrieve(); //retrieves the queue waiting in line
if(Party = True)
{
RegisterTrue.Store(A); //They'll be in another queue
WaitingSignIn.Delete(); //removes the voter from waiting in line
}
else
RegisterFalse.STore(A); //another queue
WaitingSignin.Delete(); //same as above the if statement
}
public String TrueDone()
{
RegisterTrue.Retrieve(A);
RegisterTrue.Delete();
return A.Name; //returns with the voter and party.
}
public String FalseDone()
{
RegisterFalse.Retreive(A);
RegisterFalse.Delete();
return A.Name;
}
private Queue<Precinct> WaitingSignIn = new queue<Precinct>();
private Queue<Precinct> RegisterTrue = new queue<Precinct>();
private Queue<Precinct> RegisterFalse = new queue<Precinct>();
}
Any feedback is appreciated. This question is mostly about on queue/java util while using the linux program.