Tuesday, July 28, 2009

Java help...?

i have to write a program that reads scores for 5 assignments, 4 quizzes, 1 midterm and 1 final exam.





assignments = 25%


quiz=20%


midterm=25%


final=30%


A: 90-100


B:80-89


C:70-79


D:60-69


F:%26lt;60





i have to use 2 arrays, one for items (String array) and one for score(double array)

















so far this is all i have..





class Grade


{


}


public static void main (String args[]) throws IOException {


//setup file and stream


File inFile = new File("test1.txt");


File inFile = new File("test2.txt");


File inFile = new File("final.txt");


File outFile = new File("grade.txt");


int[10] test1;


int[10] test2;


int[10] Final;


for(int i=0; i %26lt; 10; i++){


str1 = bufReader1.readLine();


int k = integer.ParseInteger(str);


test[i] = k;








double point


point = Double.parseDouble(JOptionPane.showInput... (null, "Input the score for:"+grade[i])


{


score[i]=point

Java help...?
...and you want us to finish your homework for you?





Well, from the code-segment you've already posted, you have quite a bit to do before you write the rest of the program:





you're closing the class before you've put anything in it, and so the main method is outside a class.





You've defined inFile three times





You haven't defined the data-types for variables str1, bufReader1, test[], grade[] and score[] (did I miss any?)





You also haven't told us what you want the program to do once it's read in all the scores.





I suggest you take it in stages - get a bit of the program working, then add a little more functionality, and keep doing that until you have the end result.





For example, hard-code some example data into the program, calculate the result you need, and print it out to the terminal, before you even think of parsing the data from three text files, reading keyboard input, and sending the data to an output file.

baseball cards

No comments:

Post a Comment