Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you please write the code in basic of java and in different from the one that is already posted. If you can write it
Can you please write the code in basic of java and in different from the one that is already posted. If you can write it in different way.
Homework - Topic 3 - Exam Statistics: Write a Java program, including comments, to compute statistics for how students did on an exam. 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: 1234205(IDnumber1234has20rightand5wrong) (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-mee 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 exam. 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 exam. (20 right x2). 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 al1 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. Output: Here is a complete set of output for two typical students: id123412right13wrongtotalanswered25numberomittedis25gradeis24morewrongthanrightcorrectanswerpet.is0.48010ormoreomittedid789030right15wrongtotalanswered45numberomitted1s5gradeis60morerightthanwrongcorrectanswerpet.is0.667lessthan10omitted 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. Optionals: (a) If a student answered more than 50 questions, print an error message, skip the rest of the processing, and go on to the next student. (b) Make sure that you do not divide by 0 if the student answered no questions (everything was omitted). Print a special message and go on to the next student. (c) Keep track of the student with the best correct answer percentage and the one with the highest grade. (These do not have to be the same--to test, make sure they are different.) Print these out at the end. (d) use a table to display the output 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)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started