Write C++ program that will read student records from a data file and sort the contents. Declare a class to describe a student record with private fields for: first name last name student id declared major grade point average date of birth Use appropriate data types, constructor(s), and accessor methods. Do not hard-code values. The comma-separated value (CSV) text data file students.csv is provided for development and testing. Other data files may also be used. These will have the same fields with an arbitrary number of records. After the file is read, and the data stored in memory, write a message to the console indicating how many records were read.  xx records read. Prompt the user to select the sort criterion field Sort by: (L)ast name, (S)tudent Id, (M)ajor, (G)PA, (A)ge, or (Quit) Read the single-character user selection. Sort the data records using a selection sort method. Print the sorted data records to the console using a toString() method from the class that you created. After the last records are printed, repeat the user menu selections and loop until the user selects 'Q' to quit the application. Do not use any global variables.

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

Write C++ program that will read student records from a data file and sort the contents.
Declare a class to describe a student record with private fields for:

  • first name
  • last name
  • student id
  • declared major
  • grade point average
  • date of birth

Use appropriate data types, constructor(s), and accessor methods.
Do not hard-code values. The comma-separated value (CSV) text data file students.csv is provided for development and testing. Other data files may also be used. These will have the same fields with an arbitrary number of records.
After the file is read, and the data stored in memory, write a message to the console indicating how many records were read.

  •  xx records read.

Prompt the user to select the sort criterion field

  • Sort by: (L)ast name, (S)tudent Id, (M)ajor, (G)PA, (A)ge, or (Quit)

Read the single-character user selection.

Sort the data records using a selection sort method. Print the sorted data records to the console using a toString() method from the class that you created.

After the last records are printed, repeat the user menu selections and loop until the user selects 'Q' to quit the application.

Do not use any global variables.

Alice, Johnson, 12345, Computer Science, 3.7,5-Jan-99
Bob, Smith, 23456, Electrical Engineering, 3.5,18-Feb-90
Charlie, Brown, 34567, Psychology, 3.2, 23-Mar-95
David, Lee,45678, Physics, 3.9, 12-Apr-93
Emma, Miller, 56789, English Literature, 3.6,7-May-90
Frank, Anderson, 67890, History, 3.1,29-Jun-91
Grace, Clark, 78901, Mathematics, 3.8, 14-Jul-92
Hannah, Wilson, 89012, Biology, 3.4, 30-Aug-93
Isaac, Wright, 90123, Chemistry, 3.9,11-Sep-99
James, Moore, 12346, Computer Science, 3.7,3-Oct-94
Katherine, Lewis, 23457, Electrical Engineering, 3.5, 22-Nov-97
Liam, Young, 34568, Psychology, 3.2,15-Dec-89
Mia, Hall,45679, Physics, 3.9,19-Jan-98
Noah, Turner, 56790, English Literature, 3.6,8-Feb-96
Olivia, White, 67891, History, 3.1,27-Mar-87
Penelope, Adams, 78902, Mathematics, 3.8,6-Apr-92
Quinn, Thomas, 89013, Biology, 3.4, 25-May-94
Ryan, Baker, 90124, Chemistry, 3.9,10-Jun-97
Sophia, Harris, 12347, Computer Science, 3.7,2-Jul-89
Thomas, King, 23458, Electrical Engineering, 3.5, 14-Aug-95
Uma, Scott, 34569, Psychology, 3.2,9-Sep-88
Vincent, Green, 45680, Physics, 3.9, 28-Oct-96
Transcribed Image Text:Alice, Johnson, 12345, Computer Science, 3.7,5-Jan-99 Bob, Smith, 23456, Electrical Engineering, 3.5,18-Feb-90 Charlie, Brown, 34567, Psychology, 3.2, 23-Mar-95 David, Lee,45678, Physics, 3.9, 12-Apr-93 Emma, Miller, 56789, English Literature, 3.6,7-May-90 Frank, Anderson, 67890, History, 3.1,29-Jun-91 Grace, Clark, 78901, Mathematics, 3.8, 14-Jul-92 Hannah, Wilson, 89012, Biology, 3.4, 30-Aug-93 Isaac, Wright, 90123, Chemistry, 3.9,11-Sep-99 James, Moore, 12346, Computer Science, 3.7,3-Oct-94 Katherine, Lewis, 23457, Electrical Engineering, 3.5, 22-Nov-97 Liam, Young, 34568, Psychology, 3.2,15-Dec-89 Mia, Hall,45679, Physics, 3.9,19-Jan-98 Noah, Turner, 56790, English Literature, 3.6,8-Feb-96 Olivia, White, 67891, History, 3.1,27-Mar-87 Penelope, Adams, 78902, Mathematics, 3.8,6-Apr-92 Quinn, Thomas, 89013, Biology, 3.4, 25-May-94 Ryan, Baker, 90124, Chemistry, 3.9,10-Jun-97 Sophia, Harris, 12347, Computer Science, 3.7,2-Jul-89 Thomas, King, 23458, Electrical Engineering, 3.5, 14-Aug-95 Uma, Scott, 34569, Psychology, 3.2,9-Sep-88 Vincent, Green, 45680, Physics, 3.9, 28-Oct-96
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
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
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