#Chezidek igrade code
BTW, your code happily accepts negative scores. You want to catch errors as soon as possible. The score validation belongs to the constructor. Like so const auto& s : Students can be used to loop through students because it's easy to see that s is of type Student It automatically deduces the type of the variable based on the right side of the = operator. If you want to do more c++11 things, consider using auto.static_cast is checked by the compiler at compile time instead of run time so you can avoid problems there. Don't use (double) to cast, prefer using static_cast(variable).AverageGrade and AddGrade can just be onw function, just combine their logic together.If you return a student from highest and lowest, you don't need the whoGotHighestandLowest function.This is because your checks are m_iGrade & students) From what I'm seeing, your grades are actually F: 0-9, E: 10-29, D: 30-49.That way, you cannot accidentally modify your data. Any time a function should return a true or false, it should be boolean. Then, use that check to output passed or failed. Consider changing hasUserPassed from a string to a bool.Consider changing iGrade to something like marks or totalPoints to distinguish how many points were gotten from the actual letter grade.That way, it's easier to differentiate between user defined types and functions. Class names should be PascalCase and function names should be camelCase.Remove the s and i, they're just cluttering your code with redundant information. Having names like sName and iGrade are clunky.However, there's a few issues that I can see that could be improved. Overall, your code looks pretty reasonable. Student::Student(std::string sName, int iGrade) :m_sName(sName), m_iGrade(iGrade) ) Implementations for the "Student" class Std::string HasUserPassed() //Determines whether the user has passed by checking if the grade returned is "F" Std::string CalculateGradeLetter() const //returns the "letter" of the grade Int GetGrade() const //Allows for external access to the private member variable "m_sName" Std::string GetName() const //Allows for external access to the private member variable "m_sName" Student(std::string sName, int iGrade) //Constructor to initialize member variables (in the private) Private: //Everything under "private" is only accessible from the class itself and not outside e.g. Was the highest grade achieved and by who? What was the average mark Output Name Has the student passed? What grade did they achieve? What Marking Criteria All tests are marked out of 100, with the following Marks (which should also be assigned a grade). The client also wants the following reporting to beĪdded to the system who achieved the largest mark, and the average of Whether they have passed (must be C+) the test and the grade that they The client wants to beĪble to add 8 names and 8 grades. Program Requirements The client has asked you to create a program thatĬan calculate the average grade for 8 students. I would like to know what I've done well vs what I haven't done well. I was wondering if you'd be able to review my basic C++ Grade Calculator I based off the following scenario.