Ask your own question, for FREE!
Mathematics 19 Online
OpenStudy (anonymous):

if anyone knows how to use Java please let me kno. there is noone in the chat for comp sci and i'm a math major with this for a prereq

OpenStudy (dumbcow):

its been awhile, im very rusty is this like a csc100 class?

OpenStudy (anonymous):

intro to computer programming; Starting out with Java ours is labeled csci2000

OpenStudy (dumbcow):

yeah thats what i meant whats your question

OpenStudy (anonymous):

You could have just posted the question in Comp Sci and waited a bit. I do tend to check in there now and then.

OpenStudy (anonymous):

well there was literally NOONE in there so i felt i would be talking to myself but hold on and i will copy and paste it

OpenStudy (anonymous):

Sometimes talking to yourself is helpful ;p

OpenStudy (anonymous):

or do you have something to open it if i send the java file and i'll copy and paste what were doing. i dont kno what i'm doing wrong

OpenStudy (anonymous):

haha funny funny LMAO

OpenStudy (anonymous):

You can either post it to dpaste.com (my preference) or attach it to the question.

OpenStudy (anonymous):

i posted it there under my screenname on here.... the instructions are Your program should output each candidate’s name, the number of votes received by that candidate, and the percentage of the total votes received by the candidate. Your program should also output the winner of the competition. Sample output is as follows: Finalist Votes Received % of Total Votes Johnson 5000 25.91% Miller 4000 20.72% Duffy 6000 31.09% Robinson 2500 12.95% Anthony 1800 9.33% Total 19300 The winner of the competition is Duffy. Specifications and Notes: Use the file specified above for input and the console for output. Main should primarily call methods to perform tasks. You should AT A MINIMUM have methods that do the following: 1. getVotes which reads the names and votes into parallel arrays 2. sumVotes which accepts the array of votes, a count of how many competitors were read in and returns the total votes 3. processVotes which accepts the array of votes, a count of how many items are in the array, an integer representing the total votes and fills a second array with the percentage votes for each finalist 4. determineWinner which determines the winner of the competition – you decide what needs to be sent in and returned.

OpenStudy (anonymous):

this is the file on here too

OpenStudy (anonymous):

When you post to dpaste.com you need to post here with the link to the page.

OpenStudy (anonymous):

http://dpaste.com/535088/

OpenStudy (anonymous):

Thanks =)

OpenStudy (anonymous):

sorry never seen this site before

OpenStudy (anonymous):

No thank YOU!!!!!

OpenStudy (anonymous):

You don't seem to have any of the methods they describe above, and you're not actually storing the votes as you read them in.

OpenStudy (anonymous):

You should have a method called getVotes that reads the votes from a file

OpenStudy (anonymous):

I'm not sure what your input file looks like so I can't tell if you're doing that right, but it seems as though you are except you're not doing anything with the number you read in from the file.

OpenStudy (anonymous):

i kno the way it is is the only way i could get it to print the stuff from the file. i can copy and paste the plain file text

OpenStudy (anonymous):

Sure. But fundamentally it has a name, and a string right?

OpenStudy (anonymous):

Johnson 5000 Miller 4000 Duffy 6000 Robinson 2500 Anthony 1800

OpenStudy (anonymous):

err name and number

OpenStudy (anonymous):

i completely suck at this and have no idea how i have gotten as far as i have in this class with a b but methods and arrays(ie these last two sections ) are kicking my butt

OpenStudy (anonymous):

Ok, well you can think about arrays as variables that hold many values. In this case you'll want to have 2 arrays one for the name, and the other for the number of votes that candidate recieved.

OpenStudy (anonymous):

Then you can organize them such that the i-th element in the name array corrisponds to the i-th element of the votes array.

OpenStudy (anonymous):

so they shouldnt be in the same file?

OpenStudy (anonymous):

I'm not talking about the file, I'm talking about your variables.

OpenStudy (anonymous):

oh, before i go and erase all of what i've done, is there any part of it that is correct? that i should keep?

OpenStudy (anonymous):

Some of it is, but before you do anything lets talk about what your plan is.

OpenStudy (anonymous):

http://www.dabbleboard.com/draw?b=Guest662530&i=0&c=bb4c6b8835d51e52b82fa4015e989d4d192e8250 Join here so we can also draw some pictures.

OpenStudy (anonymous):

ok

OpenStudy (anonymous):

Ok so we have 2 arrays. One with names, one with votes.

OpenStudy (anonymous):

okay i am in there under the name twignamanda

OpenStudy (anonymous):

I don't see you anymore

OpenStudy (anonymous):

i'm here and on that how do i invite you what name?

OpenStudy (anonymous):

No, just click the link I have above.

OpenStudy (anonymous):

You started your own.

OpenStudy (anonymous):

ohhhhh ok my bad i thought i had to be on it so yea i signed up but clicking now

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!