Question:
Write a JAVA program that processes the test data. The output should be the Student's ID, followed by the answ?
Moncalitta
2011-12-07 16:29:08 UTC
The history teacher at your school needs help grading a True/False test. The students' IDs and test answers are stored in a file. The first entry in the file contains the answers to the test form:

TFFTFFTTTTFFTFTFTFTT

Every other entry in the file is the student's ID, followed by a blank, followed by the student's response. Fore example, the entry:

ABC54301 TFTFTFTT TFTFTFFTTFT

indicates that the student's ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets -1 point, and no answer gets 0 points.

Write a JAVA program that processes the test data. The output should be the Student's ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale: 90% - 100% A; 80%-89.99% B; 70%-79.99% C; 60%-69.99% D; and 0%-59.99% F.

a) Compute and display the entire class average;
b) Display the names of those students who passed the class (names, grades) – Add a heading such as “Students Who Passed the Class); and
c) Display the names of those students who failed (D’s & F’s) the class (names, grades) – Add a heading such as “Students Who Failed the Class).
Three answers:
dewcoons
2011-12-07 16:43:16 UTC
So the algorithm for the program would be:



1) Read in the answers into an array with 20 elements



2) Use a loop that repeats while there are more students (not the end of the file)



3) Read in a line of data one character at a time adding them to a string until you find a space. That will indicate that end of the student ID.



4) Using a second loop, read in the next 20 characters and compare them the the 20 characters in the answer. If they match (right answer) add 2 to a total. If they do not match (wrong answer) subtract 1 from the total



5) Compare the final total to the grade levels and assign a letter (case statement)



6) Save the Student ID, grade and the total into an array



7) Keep looping until you reach the end of the file



8) Print out the array with the IDs, grades and score using a loop



9) Print out the first header



10) Using a loop and if statement, print out any IDs, grade and scores where the score is 60 or better



11) Print out the second header

11) Using a loop and if statement, print out any IDS, grade and scores where the score is below 60



Now all you have to do is write one step of the program at a time....
?
2016-10-24 04:21:50 UTC
Loop1 subloop1 if1 print subloop1 subscript else print area end if1 end subloop1 subloop2 if2 print subloop2 subscript else print area end if2 end subloop2 print new line end loop1 that's no longer perplexing and that i'm specific that somebody provides you with the finished answer. The question is do you opt to study?
Teoyaoimquit
2011-12-07 16:54:26 UTC
I would create a student class that holds a string for I.D., string for answer and and Int for score. Read in the file line by line and separate the answer from the string. For checking create a for loop. for ( int i=0; i < answer.length(); i++) {

if (answer.charAt(i).equals(answerKey.charAt(i))){

score=score+2;

{

else if (answer.charAt(i).equals(' ')){

score+= 0;

}

else { score-- };



create a variable for classAverage and calculate it by using a loop to cycle through the students scores and test for the appropriate cases.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...