Re: How to "drop" scores?
Quote:
Originally Posted by
Actinistia
I was thinking about using if/else conditions but that wouldn't really limit the amount dropped to 3. Any advice is appreciated!
It would if you kept track of how many you dropped so far.
Re: How to "drop" scores?
Quote:
Originally Posted by
KevinWorkman
It would if you kept track of how many you dropped so far.
Why didn't I just think about that! Thanks, I'll try creating a counter to keep track of it and see how it works.
*edit* Would something like this work? Ignoring the first part of the condition (since I'm still trying to figure out how to create the "best" percentage). I placed this within the for loop after the last if condition and before the results.
Code java:
if ((score[i] > (max[i]/2)) && (counter <= 3)); // Suppose to allow 3 inputs to be "dropped" or turn inputted value to 0
{
score[i] = 0;
max[i] = 0;
counter++;
}
*edit2* I was just going over this condition and I think I messed up because now it makes each of array elements to 0. But would this be somewhere along the lines of what I should do?
Re: How to "drop" scores?
Something along the lines, sure. But I can't really tell you much else, since we don't know what is in the score array or the max array, or even what the program is supposed to actually do. Keeping track of the count like that is probably the way to go though.
Re: How to "drop" scores?
Quote:
Originally Posted by
KevinWorkman
Something along the lines, sure. But I can't really tell you much else, since we don't know what is in the score array or the max array, or even what the program is supposed to actually do. Keeping track of the count like that is probably the way to go though.
Thanks for the previous suggestion! In my first post, I gave a link to another thread I made which had the actual requirements of the program on it. Basically the program is suppose to create the best possible percentage for a student by dropping 3 assignment scores. The score array and max array each store a score (e.g. 35 out of 40 possible points, score[i] stores the 35 and max[i] stores the 40). I had thought about putting them both into an array having the score and max alternate but wasn't sure if it was better to do. I felt that working with 2 separate arrays was easier to work with. Anyways, thanks again!
Re: How to "drop" scores?
Quote:
Originally Posted by
Actinistia
Thanks for the previous suggestion! In my first post, I gave a link to another thread I made which had the actual requirements of the program on it. Basically the program is suppose to create the best possible percentage for a student by dropping 3 assignment scores. The score array and max array each store a score (e.g. 35 out of 40 possible points, score[i] stores the 35 and max[i] stores the 40). I had thought about putting them both into an array having the score and max alternate but wasn't sure if it was better to do. I felt that working with 2 separate arrays was easier to work with. Anyways, thanks again!
Well, do whatever fits into your head. But just a tip- you might want to stop to think about how you'd do this "by hand" without a program. Given a stack of grades, how would you figure out which three to drop? Write out basic instructions, pretend you're writing them for a really dumb friend who needs to do this. When you have that written out, you'll have a basic algorithm that should be pretty easy to translate into code.