7. Write a complete Java program (including import statements, comments and all variable declarations and initialization where needed) for the following problem. DO NOT USE ARRAYS The program will read from the keyboard an unknown number of student records. Each record contains the ID number (integer) and three test scores (double) of a student. A value of the ID greater than 999 indicates to stop reading data. Sample input: 167 87 90 92 763 72 97 88 512 134 87 76 440 89 96 -10 1000 I. Ask the user to enter the first ID II. Using a loop of your choice: a. If the IDis greater than 999 then terminate reading data - do not read in any test scores but go to step IV. b. If the ID is less than or equal to 999, continue with step III.a. III. a. Read in the three test scores and compute their average b. If any of the test scores is less than 0 or greater than 100, print an error message that the test scores are invalid and include the ID of that record in the error message. Keep track of how many records with errors were read in. Do not process the record. Skip to step III.g. c. Print the ID, the three test scores and the average (with 1 decimal place) to the console. d. Keep a running sum of the test score averages e. Keep a count of how many students were read in f. Keep track of the highest average test score and the ID associated with that average g. Read in the next ID h. Return to step II.a. IV. When an ID greater than 999 is read in, do as follows: If the number of records read in is 0, then print "No records read in" and end the program If the number of records read in is at least 1, then print the following, each with a description: i. The total number of records read in. ii. The number of records with errors. iii. The overall average for all students. iv. The highest average score and the ID of the student with that average. a. b.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
7.Write a complete Java program (including import statements, comments
and all variable declarations and initialization where needed) for the
following problem. DO NOT USE ARRAYS
The program will read from the keyboard an unknown number of student
records. Each record contains the ID number (integer) and three test
scores (double) of a student. A value of the ID greater than 999
indicates to stop reading data.
Sample input:
167 87 90 92
763 72 97 88
512 134 87 76
440 89 96 -10
1000
I.
Ask the user to enter the first ID
Using a loop of your choice:
a. If the IDis greater than 999 then terminate reading data -
do not read in any test scores but go to step IV.
b. If the ID is less than or equal to 999, continue with step
III.a.
II.
III.
a. Read in the three test scores and compute their average
b. If any of the test scores is less than 0 or greater than
100, print an error message that the test scores are
invalid and include the ID of that record in the error
message. Keep track of how many records with errors were
read in. Do not process the record. Skip to step III.g.
c. Print the ID, the three test scores and the average (with 1
decimal place) to the console.
d. Keep a running sum of the test score averages
e. Keep a count of how many students were read in
f. Keep track of the highest average test score and the ID
associated with that average
g. Read in the next ID
h. Return to step II.a.
IV.
When an ID greater than 999 is read in, do as follows:
If the number of records read in is 0, then print "No
records read in" and end the program
If the number of records read in is at least 1, then print
the following, each with a description:
i. The total number of records read in.
ii. The number of records with errors.
a.
b.
iii. The overall average for all students.
iv. The highest average score and the ID of the student
with that average.
Transcribed Image Text:7.Write a complete Java program (including import statements, comments and all variable declarations and initialization where needed) for the following problem. DO NOT USE ARRAYS The program will read from the keyboard an unknown number of student records. Each record contains the ID number (integer) and three test scores (double) of a student. A value of the ID greater than 999 indicates to stop reading data. Sample input: 167 87 90 92 763 72 97 88 512 134 87 76 440 89 96 -10 1000 I. Ask the user to enter the first ID Using a loop of your choice: a. If the IDis greater than 999 then terminate reading data - do not read in any test scores but go to step IV. b. If the ID is less than or equal to 999, continue with step III.a. II. III. a. Read in the three test scores and compute their average b. If any of the test scores is less than 0 or greater than 100, print an error message that the test scores are invalid and include the ID of that record in the error message. Keep track of how many records with errors were read in. Do not process the record. Skip to step III.g. c. Print the ID, the three test scores and the average (with 1 decimal place) to the console. d. Keep a running sum of the test score averages e. Keep a count of how many students were read in f. Keep track of the highest average test score and the ID associated with that average g. Read in the next ID h. Return to step II.a. IV. When an ID greater than 999 is read in, do as follows: If the number of records read in is 0, then print "No records read in" and end the program If the number of records read in is at least 1, then print the following, each with a description: i. The total number of records read in. ii. The number of records with errors. a. b. iii. The overall average for all students. iv. The highest average score and the ID of the student with that average.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education