Ask Programming Language Expert

Assignment

College maintains a file of credit hours completed for their students, named CREDITS.TXT. Each line of the file contains:

• the student's ID number (an 8-character string, containing 2 letters followed by 6 digits)

• the student's status (an character: U for undergraduate, G for graduate, A for alumni)

• the student's number of completed credits on each line.

Example:

CC333333 U 3

AA111111 G 36

BB222222 U 80

DD444444 U 52

CD334455 U 100

BC223344 U 10

AB112233 A 134

EE555555 G 18

DE445566 U 122

The college would like you to write a program to convert the number of completed credits for all Undergraduate students to class levels, and to make the data searchable by student ID number.

The college uses the following completed credit ranges to determine the class levels:

Credits Completed Class Level:

Under 32 Freshman

32 - 63 Sophomore

64 - 95 Junior

Over 95 Senior

Create an enumerated type that has the class levels as its values, in the order given, so that the ordinal value of FRESHMAN will be 0, and the ordinal value of SENIOR will be 3.

Program Implementation

The program will do the following:

1. Display a short description of what the program will do to the user.

2. Verify the input data file exists. If it does not exist, issue an error message and exit the program immediately.

3. Read the data from the input file. For each line of data read: If the student is an undergraduate student

• Call a function to convert the credits completed to a class level

• Store student data into two separate parallel arrays.

• (NOTE: Even if you know how, you may not use an array of records!)

The first array will hold the string-type student ID number. The second array will hold the corresponding class level of the student.

You must store the enumerated type value in the second array, not the ordinal integer value.

Since the program will only be storing data for undergraduate students, if the student is not an undergraduate student, the student ID or class level will not be saved anywhere.

The arrays will be defined to hold up to 1000 items each. You can use the same count variable for both arrays, since they will always hold the same number of items.

Your code must implement array bounds error checking.

So if the file contains too many lines of data:

• Issue an error message

• Stop reading data from the file.

• Continue the program with the 1000 records in the arrays.

NOTE: The program should not issue an error message if the file contains exactly 1000 undergraduate students - only if it contains more than 1000 undergraduate students.

4. Use the selection sort to sort both parallel arrays in descending order, based on the student ID number. Remember that strings in arrays can be compared the same way that numbers can, using the less than and greater than operators.

Example: if ( studentId[oneIndex] < studentId[anotherIndex] )

NOTE: All the sample code shown in the week-by-week and in the textbook sorted in ascending (low to high) order. You will need to modify the code so that it sorts in descending (high to low) order.

5. Write the data from the sorted arrays out into another file, SORTED.TXT. This file should store one student ID and one corresponding class level per line. Sample SORTED.TXT data file (corresponding to sample input data file):

Example

DE445566 3

DD444444 1

CD334455 3

CC333333 0

BC223344 0

BB222222 2

Note that the ordinal value of the credit rating enumerated type is stored in the data file. This enables the program to simply write the data to the file from the enumerated type field, with no conversion.

6. After sorting and storing the data, loop to display the class level for specified students, as follows:

a) First display all student ID numbers in the array (horizontally, with 5 IDs per line), so the user can see his/her choices.

b) Then prompt the user for a student ID number (or X to exit the program).

Sample Output:

Student ID numbers on file are: DE445566 DD444444 CD334455 CC333333 BC223344 BB222222 Enter ID number of student to find (or X to exit):

c) After reading the student ID entered by the user, and before the program searches for the student, the program should error check that the user entered ID number is ***** correctly (i.e. 2 letters followed by 6 digits).

NOTE: Error checking of the characters in the student ID number should be done using loops, not by using brute force to check each individual character. Remember that you can access the individual characters within a string, as if the string was an array of characters.

For example: inputIdNumber[0] could be used to access the first character in the student ID number input by the user.

The program is due Thursday. Here is some more information you may need

HINT: For each index, use the position index to determine whether the character should be a letter or digit. Then use a character function from the cctype library to check for a letter, if it should be a letter or to check for a digit if it should be a digit.

If an invalid student ID number format is entered, give a descriptive error message explaining the correct format, and re-prompt until a good student ID number is *****

Examples: Input AA3333333 is too long. ID must be exactly 8 characters long. OR Input 3A333333 letters and digits are not in the right places ID must be exactly 8 characters long, formatted as: XX######

NOTE: The letters may be entered in either upper or lowercase, but the program should uppercase them before using them to search in the next step.

d) Use the student ID number with a binary search to find the student requested. If found, display the corresponding class level (in words) for the specified student. If not found, display an appropriate error message.

Examples: The student with ID DD444444 is a sophomore. OR No student with ID WW888888 was found.

NOTES:

Again, the binary search examples in the online Content assumed an ordered array sorted in ascending order. You must modify the search for use with arrays that are sorted in descending order.

You will need to write code to convert the enumerated class level value to a string, for display.

e) Loop displaying student ID choices, asking for an ID number, and displaying the student's class level, until the user enters "X" (or "x") to exit the program, at the student ID prompt.

You will turn in a structure chart for this program, along with the code. Your structure chart should contain one rectangle for each function in your program and include all data values passed into/out of each function (see online Content section 2.6.1 through 2.6.3 for structure chart details).

Notes

1. All fixed values within the program should be defined as constants.

2. Descriptive function, constant, and variable names must be used.

3. Your program must conform to the CS362 Coding Standards specified in Content section 1.7. As such, the program must include a file header comment block at the top of the program, and each function must include a function header comment block.

4. This program should be of modular design (minimum of SIX user-defined functions that have arguments or return values), and use proper parameter passing and prototypes.

The breakdown of the code into functions must be logical, not arbitrary!

The main function should do little more than call other functions.
The other functions should each perform ONE well-defined task.

5. All code will be structured C++ code. Object-oriented programming (classes, templates, etc) will not be used.

6. Your program should be thoroughly tested, and test data files should be submitted.

is not adequately modular (i.e. contains fewer than the required number of functions)

does not include a structure chart with the submission Before attaching files to the assignment submission.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92078937
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As