Problem description Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The program should compute the GPA (grade point or quality point average) for each student (the total quality points divided by the number of semester hours) then write the student information to the output file if that student should be put on academic warning. A student will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other students. Do the following: 1. Create a text data file "students.dat". The following shows part of a typical data file: Smith 27 83.7 Jones 21 28.35 Walker 96 182.4 Doe 60 150 2. Set up a Scanner object scan from the input file and a Print Writer out File to the out- put file inside the try clause. Note that you'll have to create the Print Writer from a FileWriter, but you can still do it in a single statement. 3. Prompt the user for a filename. If the user enters the name of a file that does not exist, ask for another name until you get one that refers to a valid file. 4. Inside the while loop add code to read and parse the input get the name, the number of credit hours, and the number of quality points. Compute the GPA, determine if the student is on academic warning, and if so write the name, credit hours, and GPA (separated by spaces) to the output file.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.5: A Case Study: Pollen Count File Update
Problem 4E
icon
Related questions
Question

please explain all details because i sent this before but i got wrong code and you know i pay for this, thank you

Problem description
Write a program that will read in a file of student academic credit data and create a list
of students on academic warning. The list of students on warning will be written to a file.
Each line of the input file will contain the student name (a single String with no spaces), the
number of semester hours earned (an integer), the total quality points earned (a double).
The program should compute the GPA (grade point or quality point average) for each student
(the total quality points divided by the number of semester hours) then write the student
information to the output file if that student should be put on academic warning. A student
will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester
hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other
students. Do the following:
1. Create a text data file "students.dat". The following shows part of a typical data file:
Smith 27 83.7
Jones 21 28.35
Walker 96 182.4
Doe 60 150
2. Set up a Scanner object sean from the input file and a Print Writer outFile to the out-
put file inside the try clause. Note that you'll have to create the Print Writer from a
FileWriter, but you can still do it in a single statement.
3. Prompt the user for a filename. If the user enters the name of a file that does not exist,
ask for another name until you get one that refers to a valid file.
4. Inside the while loop add code to read and parse the input get the name, the number
of credit hours, and the number of quality points. Compute the GPA, determine if
the student is on academic warning, and if so write the name, credit hours, and GPA
(separated by spaces) to the output file.
Transcribed Image Text:Problem description Write a program that will read in a file of student academic credit data and create a list of students on academic warning. The list of students on warning will be written to a file. Each line of the input file will contain the student name (a single String with no spaces), the number of semester hours earned (an integer), the total quality points earned (a double). The program should compute the GPA (grade point or quality point average) for each student (the total quality points divided by the number of semester hours) then write the student information to the output file if that student should be put on academic warning. A student will be on warning if he/she has a GPA less than 1.5 for students with fewer than 30 semester hours credit, 1.75 for students with fewer than 60 semester hours credit, and 2.0 for all other students. Do the following: 1. Create a text data file "students.dat". The following shows part of a typical data file: Smith 27 83.7 Jones 21 28.35 Walker 96 182.4 Doe 60 150 2. Set up a Scanner object sean from the input file and a Print Writer outFile to the out- put file inside the try clause. Note that you'll have to create the Print Writer from a FileWriter, but you can still do it in a single statement. 3. Prompt the user for a filename. If the user enters the name of a file that does not exist, ask for another name until you get one that refers to a valid file. 4. Inside the while loop add code to read and parse the input get the name, the number of credit hours, and the number of quality points. Compute the GPA, determine if the student is on academic warning, and if so write the name, credit hours, and GPA (separated by spaces) to the output file.
5. After the loop close the Print Writer.
6. Think about the exceptions that could be thrown by this program:
A
FileNotFoundException
if the input file does not exist.
A NumberFormatException
if it can't parse an int or double when it tries to
- this indicates an error in the input file format.
An IOException if something else goes wrong with the input or output stream.
Add a catch for each of these situations, and in each case give as specific a message as
you can. The program will terminate if any of these exceptions is thrown, but at least
you can supply the user with useful information.
7. Test the program. Test data is in the file "students.dat". Be sure to test each of the
exceptions as well. Use a driver for that.
Transcribed Image Text:5. After the loop close the Print Writer. 6. Think about the exceptions that could be thrown by this program: A FileNotFoundException if the input file does not exist. A NumberFormatException if it can't parse an int or double when it tries to - this indicates an error in the input file format. An IOException if something else goes wrong with the input or output stream. Add a catch for each of these situations, and in each case give as specific a message as you can. The program will terminate if any of these exceptions is thrown, but at least you can supply the user with useful information. 7. Test the program. Test data is in the file "students.dat". Be sure to test each of the exceptions as well. Use a driver for that.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
User Defined DataType
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr