Question: Task B: For Task B, there is an input data file with file name csc242project2in.txt that can be downloaded from Week Three ? Project 2.

Task B: For Task B, there is an input data file with file name csc242project2in.txt that can be downloaded from Week Three ? Project 2. For each student, it maintains a Student ID, the last name and first name, and the current balance in cents (0 to 99999). Your Task B is to read the records in the given input file (housed in the same working directory where the project file with the .vcxproj file extension is) into arrays, sort the records in the arrays. Then, the user can search for the record for a particular student and update the current balance. When the user is done with all the searching and updating, the program saves the new records in the array to a new output file csc242project2out.txt in the same directory before ending execution.

Details are described below.

The input file is a file of student information. Each record occupies one physical line in the file. Each record has the data fields: STUDENT_ID (a string of 6 characters), STUDENT_LAST_NAME (a string of maximum 20 characters), STUDENT_FIRST_NAME (a string of maximum 15 characters), and STUDENT_ CURRENT_BALANCE (maximum 5 characters long). There is a space between two fields.

Two examples are:

F12345 Miller-Jenkins Anne 900

M13876 Shoemaker Peter 4500

Task B is to do the following (please read the grading sheet for all the detailed requirements):

I.

Serve the user in two phases: Phase A:

(1) Read all input records one by one into arrays in main memory.

(2) Display all the records on the screen in the order they are read from the input data file.

(3) Do a Selection Sort (must be implemented as a function) to sort the records in ascending order on STUDENT_ID and display all the full records correctly in the correct order after sorting.

Phase B:

(1) Then, the user can do the following until he/she chooses to exit Task B: (1a) Search for a STUDENT by STUDENT_ID (must be implemented as a function) (1b) If the search STUDENT_ID is found, then after (1a), the system displays the complete information of this STUDENT on the screen. Then, the user can either subtract or add a particular number of cents (an integer) to update the current BALANCE of this student once. (1c) If the search STUDENT_ID is not found, then after (1a), the system displays the message Student not found.

(2) When the user chooses to quit Phase B Step (1), the system writes all records with the current values for the data fields from the arrays (from slots 0 to the last slots with data) into a new output file in the same folder and the file name is to be csc242project2out.txt. The record format is to be the same record format as the input file. We expect the order of records in this new file to be in ascending order on STUDENT_ID.

II.

Your program displays Updating of records done and the new file is: csc252hw3out.txt and return to the Main Menu.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!