Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10 Write a complete Java program (including import statements and all variable declarations and initialization where needed) for the following problem The program wil1 read

image text in transcribed

image text in transcribed

10 Write a complete Java program (including import statements and all variable declarations and initialization where needed) for the following problem The program wil1 read from the console an unknown nunber of student records Each record contains the GPA (double) and id number (integer) of a student The last record has a value of -1 for the GPA. a. Using a loop of your choice, read in the GPA and id number of each student. Be sure to include prompts for each piece of input. For example Enter the student GPA. If the GPA is -1 do not read in the id number. Stop reading input and continue with steps e. thru g. b. As you read in a record, print the GPA and id number of the student to the console. For exampleg GPA: 3. 45 ID: 1234 . Keep a running sum of the GPA of all students(for use in the computation of the average GPA below) . Keep track of the highest GPA and the id number of the student with that highest GPA d. If the first GPA read in is , stop reading input, print the string literal "no data has been entered" and D0 NOT perform any computations of steps e. g. below When al1 data has been read in and there is at least one complete student record, print the following: e. The total number of student records read in f. The average GPA for all students (tHo decimal places) The id number and GPA (two decimal places) of the student with the highest GPA In each of the three output statements, include a description of what the variable contains before you Print the variable. For example, The total number of students read in is 7 2012 695 words English (United States) computation of the average GPA below). Keep track of the highest GPA and the id number of the student with that highest GPA d. If the first GPA read in is -1, stop reading input, print the string literal "no data has been entered" and DO NOT perform any computations of steps e. -g. below. When all data has been read in and there is at least one complete student record, print the following: e. The total number of student records read in f. The average GPA for all students (two decimal places) g. The id numb er and GPA (two decimal places) of the student with the highest GPA In each of the three output statements, include a description of what the variable contains before you print the variable. For example, The total number of students read in is 7 The average GPA for all students is 3.15 The highest GPA was 3.87 from student id 123

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 Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

Who is to blame for this communication gap? Why?

Answered: 1 week ago