代写GPA Analyzer调试C/C++语言

2024-12-23 代写GPA Analyzer调试C/C++语言

GPA Analyzer (GPA)

Problem.

Your friend has asked you to help them with a project. They are interested in analyzing one students’ grades. Create a program which will accept an unlimited number of grades and calculates the average score for all the grades. Assume each test is worth 100 points. Suggested letter grades scale of 90+ ’A’, 80+ ’B’, 70+ ’C’,60+ ’D’ , less than 60 are ’F’. Remember, your data structure must hold an unlimited amount of data.

Requirements.

· Your code must be readable inside Canvas (no garbage files).

· Your code must compile under the gcc compiler (g++ compiler is an alias to gcc).

· Your code must execute under Ubuntu 14.00 or greater.

· Your output must be logically correct.

· Create a numeric menu driven program. Figure 1 is an example of what this menu would look like. Add grade adds a student grade. Display all grades dumps all the scores to the console. Process all grades calculates the gpa for all the grades. The program continues to run until option 4 - quit, is selected.

· You cannot use anything from the standard template library.

· Use functions whenever possible to modularize your code. Use function prototypes and code the functions under main().

· Include a Source File Header. I’ll look for comments like this:

// title.cpp 

// Pat Jones, CISP 413

// 12/34/56

· Include a ProgramGreeting function which runs at the very start of the program. You can display the same information as in your source file header on the terminal.

Main Menu.

1. Add Grade.

2. Display All Grades.

3. Process All Grades.

4. Quit Program.

Figure 1: Example of the main menu for this assignment.

Specification Bundles.

These are additional features for your program. Specifications are bundled into groups: "A", "B", and "C". These groups correspond to the highest grade you can get for your code (i.e. completing "C" specifications means I start evaluating your assignment from a C). This gives you some control over your potential grade. The more work you do, the better grade you can get. There is also a loose association with difficulty, "C" elements tend to be a bit easier than "A" elements.

"C" Specification Bundle.

// Specification C1 - Three Functions 

Include at least three functions in your program. Put this specification comment above your function prototype(s).

// Specification C2 - Print Scores

Print all scores entered to screen when menu selection 2 is chosen. Include the letter grades for each numeric score you print out. Either use a function or method called Grade2Lttr() which receives the numeric score and converts it to a letter grade. Return an ’X’ if the grade score is too high or too low - invalid grade.

// Specification C3 - Compute GPA

Compute the average for all grades for the client and display it when menu selection 3 is chosen.

// Specification C4 - Function Activity to Disk

Write a message when every function is called. Save this in a file called “log.txt”. Include a timestamp and a message string for each line you save in your log. Log when a function is called - at a minimum. If you also log the time the function ended, you can then compute the Elapsed Time (or have the program compute it!) for your Peer Review. It is also VERY helpful for debugging to log the incoming and outgoing parameter values.

"B" Specification Bundle.

// Specification B1 - Dynamic Array

Create an array on the heap. Store student scores in it. This array should automatically resize itself - no pseudodynamic arrays!

//Specification B2 - Add Elements

Start your array at size 0 or 1 (your call) and increase it by one every time you add a new score with menu option 1. Use array pTmp to hold the address of the new memory location and then switch it with the main program data structure - like we did in Class.

// Specification B3 - Menu Input Validation

Only accept numbers in the range of valid inputs (1..4). Reject all other numeric menu input and re-prompt. Don’t worry about other potential types of errors. I suggest you put this in a function so you can move it to other homework assignments easily.

// Specification B4 - Highlight Failing Grades

Create a FancyText class which allows you to print a string to the console in a different colored text. The method you pass the string to can either emit a modified string with the ASCII color codes concatenated to it or you can just print to cout in the method. Either way, make failing grades appear in red text and be sure to reset it to normal when you are done.

"A" Specification Bundle.

// Specification A1 - Date class

Put all the date code in class Date class. You will want a method to display the date in the proper format: mm/dd/yyyy. Have the object initialize itself by querying the system date.

// Specification A2 - External date initialization

Create a method for your Date class called SetDate which allows you to change the date for a particular instance. You call the method and pass in the new date.

// Specification A3 - Component Test Method in Date

Create a void CompTest method in the date class which performs self diagnostics. That is, it instantiates a date object with known data and then compares the results with expected, correct, answers. Use this to demonstrate your input routines are working. Prove month, day, and year are indeed set correctly by A2 and the resulting output is formatted as expected.

// Specification A4 - Unit Test

Add a void UnitTest function to your program. You can run A3 here, but also use this to verify your score to letter grade conversion function (C3) is working correctly. Prove each letter works right as well as error checking for too high and too low scores. This runs before your program greeting. It get’s turned off for production code, but I want to see it run and confirm the tests are working on your homework. The more tests, the more reliable, but I want to see at least 2.

Due Date.

This assignment is due by 11:59 PM on Sunday on the date on the calendar in Canvas. Example, if this assignment appears on the Canvas calendar during week 2, the assignment will be due that Sunday at 11:59 PM. All the assignments are open the first day of class and you can begin working on them immediately. I encourage you to start sooner rather than later with your homework, these always seem to take longer than you think. 

How to Turn in your Homework.

Turn homework in by uploading to the appropriate Canvas Dropbox folder. Save your homework as a .cpp file. Then rename it to a .txt file. Upload this .txt file to Canvas. Don’t zip or otherwise compress your files. Do NOT split your file up into multiple files. I know that is a standard industry practice, but it just get’s in the way for this class. I ONLY accept homework through the Canvas Dropbox. Do not add it to the comments or email me - I will not accept it. If you are having trouble submitting the assignment, email me immediately. Make sure you upload it a few minutes before the assignment closes in Canvas. If you go over by just one second - you are late.