Hello everyone, I've been working on a new program that my professor gave us for general practice. I've gotten a bit of code with gets user input and outputs a percentage in the end but to do what the program requires, would I have to create an array?

Here's the objective of the program:

This problem is from a semi-recent programming competition. Lots of top programmers couldn't figure it out, but it only requires CS107 commands and info, and it's somewhat short (not too short, of course), so show how you would complete it! "COLLEGIATE PROGRAMMING COMPETITION, 2006" "Grade Dropping 101" Consider a college course [not cs107] in which students are allowed to drop scores for up to 3 course assignments. But, students have to choose which ones to drop, to yield the highest course score. Each assignment may have a different maximum score. You must write a program that, given a list of assignment results, will calculate the best assignment percentage grade that can be obtained by dropping three of the assignments. [WARNING: You do NOT necessarily get it by dropping the lowest-percent assignments!] EXAMPLE: Consider these assignment scores: * 41 points out of 42 * 22 pts out of 64 * 2 pts out of 26 * 11 pts out of 44 * 24 pts out of 27 * 26 pts out of 70 * 4 pts out of 30 The grade percentage when dropping zero assignments is: (41+22+2+11+24+26+4) / (42+64+26+44+27+70+30) = 42.9% But, you could improve that percentage, by choosing 3 scores to drop. What is the maximum percentage possible, by dropping 3 scores? (In this case, it is 56.8%) INPUT: Input to your program is: * The number of assignments. (This is at least 4, and at most 30.) * The student's scores, and the maximum points, one at a time, for each of the assignments. (Scores are at least 0, and at most the maximum.) (The maximum scores at least 1, and at most 100.) OUTPUT: * The best possible final assignment percentage, from dropping 3 scores.

Code I have so far:

import java.io.*; public class HW8X { public static void main(String args[]) throws IOException { BufferedReader keybd = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter # of assignments: "); int x = Integer.parseInt(keybd.readLine()); double result = 0; double result2 = 0; for (int i = 1; i <= x; i++) { System.out.print("Enter student's score: "); double score = Double.parseDouble(keybd.readLine()); System.out.print("Enter max score: "); double max = Double.parseDouble(keybd.readLine()); result = result + score; result2 = result2 + max; } System.out.println("Original percentage: " + (result/result2)*100.0 + "%"); }// Ends main routine }// Ends class

I know that I haven't added the conditions yet, but it's just a general outline for now. I'll be working on it more later.

Thanks for the help!

-Actinistia