Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

have to use import javax.swing.JOptionPane;Use a while Loop , use while Statement, Interactive Data Entry Using Scanner Class Objects, Homework - Topic 3 - Exam

image text in transcribed

image text in transcribed

have to use import javax.swing.JOptionPane;Use a while Loop, use while Statement, Interactive Data Entry Using Scanner Class Objects,

Homework - Topic 3 - Exam Statistics: Write a cava program, includirg comments, to compute statistics for row swudents 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 rew 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 (q) below] and then the rumber of right answers and the number of wrong answers. (The Lolal number of questions on the test is 50 . tor example, the program could read in the following: 1234205(tanumber1234has20rightand5wrong: (b) The program computes ard prints the total number of questions answered plus the number omitted (which is simp-y 50 mirus the number answered). The number right plus the number wrong will never be more than 50 [see optional (a) be ?ow]. (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-osee optioral (b). ] For the data valiea 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 lignoring the wrong ansmersi. For example, Id number 1234 gol a numerical grade of 40 on the exam (20 right x 2) . Tre 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 appropriale message. iti The progran determines if the studert omitted ten or more questions it prints a message with this informaticn. (g) Then the program skips a fow lines and repeats the ontire process for the next studert until the last student is finished. (you rust decide how to reeognize the last student.) (Hint: use a sentinel.) (h) At thet point, print the total number of students in the class (you mast. keep track of this as the program executes and stop. Dala: Be sure to read in data for at least 12 students. Make sure lhal you have at least cwo with the same numoer right and wrong, at least two with more wrong than right, and at least two with more right than wrong. Include a student with a-l wrong answers and one with all right answers (but not 50 right). Have some students who don't omit anytring and some who omit almost all the questions. ourplil: Here is a complete sel of outpul for two lypical students: id123412right13wrongtotalanswered25nu.mberomilhedis25gradeis24morewrongthanrightcorrectanswerpet.is0.480loormoreomittedid789030righttotalanswered45numberomilledis5gradeis60morerightthanwrongcorrectanswerpct.isc.667lessthanleomitted 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. oplionals: (a) If a studert answered more than 50 questions, print an error message, skip the rest of tre 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 cn to the next student. (c) Keep track of the student with the best correct answer percentage and the one with tre highest grade. (These do not have to be the same-rto 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

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

Students also viewed these Databases questions