Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program, including comments, to compute statistics for how students did on a test. The program should compute various things about a student,

Write a Java program, including comments, to compute statistics for how students did on a test. The program should compute various things about a student, and print it all out. Then it repeats the process for each new student until the entire set of data has been completed.

(a) The program reads in (from a file) and prints the ID number of a student [see step (g) below] and then the number of right answers and the number of wrong answers. (The total number of questions on the test is 50.) For example, the program could read in the following: 1234 20 5 (ID number 1234 has 20 right and 5 wrong)

(b) The program computes and prints the total number of questions answered plus the number omitted (which is simply 50 minus the number answered). The number right plus the number wrong will never be more than 50 [see optional (a) below].

(c) The program computes the student's correct answer percentage, which is a decimal value between 0 and 1. The correct answer percentage is the number of right answers divided by the number of questions answered. [The student always answers at least one question--see optional (b).] For the data values shown for ID number 1234 above, the correct answer percentage is 20 / 25 = 0.800. The program should print this out as shown, with three decimal places.

(d) The program also assigns the student a numerical grade on the test. The numerical grade is the number of right answers times 2 (ignoring the wrong answers). For example, ID number 1234 got a numerical grade of 40 on the test (20 right x 2). The program prints the student's grade.

(e) The program determines if the student had more right than wrong answers, the same number of each, or more wrong than right answers. It prints an appropriate message.

(f) The program determines if the student omitted ten or more questions. It prints a message with this information.

(g) Then the program skips a few lines and repeats the entire process for the next student until the last student is finished. (You must decide how to recognize the last student.) (Hint: use a sentinel.)

(h) At that point, print the total number of students in the class (you must keep track of this as the program executes) and stop.

Data: Be sure to read in data for at least 12 students. Make sure that you have at least two with the same number right and wrong, at least two with more wrong than right, and at least two with more right than wrong. Include a student with all wrong answers and one with all right answers (but not 50 right). Have some students who don't omit anything and some who omit almost all the questions.

image text in transcribed

Note: Data input must come from a file Output must be file directed. Do not send prompts to the output file. Do not use global file objects.

Required Submission: 1. The Java source code file (e.g., HW3.java) 2. The test cases input file (e.g., testCases.txt) 3. The program generated output file (e.g., output.txt)

Output: Here is a complete set of output for two typical students: id 1234 12 right 13 wrong total answered 25 number omitted is 25 grade is 24 more wrong than right correct answer pct. is 0.480 10 or more omitted id 7890 30 right 15 wrong total answered 45 number omitted is 5 grade is 60 more right than wrong correct answer pct. is 0.667 less than 10 omitted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

LO14.1 Describe the characteristics of oligopoly.

Answered: 1 week ago