MyGrade Calculator Project: Main Menu Manage Assignments Manage Categories Display Grades Exit Manage Assignments Add Assignment -- completed -- include validation – if a category does not exist then...

t:

  1. Must be documented

  2. Accept input from user

  3. Must use all control structures: if, switch, loops

  4. Must use data types properly

  5. May use manipulators

  6. Must use file input and output

  7. Must use functions appropriately

  8. Must use arrays or vectors and associated functionalities (searching, sorting, etc)

Must use a struct or a class


MyGrade Calculator Project: Main Menu Manage Assignments Manage Categories Display Grades Exit Manage Assignments Add Assignment -- completed -- include validation – if a category does not exist then then user can add a new category first, then use it. Delete Assignment -- not completed – very similar to Edit Edit Assignment -- completed Main Menu Manage Categories Add Category Delete Category Edit Category Main Menu Display Grades Display all Assignments Display Grade Summary Main Menu Display All Assignments AssignmentAssignment NameScore 1HmwkCh01P12100 2… -- This portion is completed Display Grade Summary --sample CategoryWeight Category Average Class Score MidTerm20%7815.6 Final20%---- Quizzes10%898.9 ICA Homework Project Total Class Score: 81.2 Class Grade: B #include #include #include "gradeCalc.h" #include #include #include using namespace std; //function prototypes /*Make this into a menu driven program using vectors Add Assignments Edit Assignments Delete Assignments Display Grades Exit The program will store the assignments in a single text file. As such you will need to load all the data from the file when the program begins and save all the assignments to the same file when you exit. For the edit functionality: Edit Assignments -->display a list of the assignments and allow the user to select which index to edit Delete Assignments Functionality display a list of the assignments and allow the user to select which index to delete */ //******************************************************************************************// // This is your Homework For Tuesday 11/24/2020 // // 1: Write your menu function // // 2: implement the add assignment functionality. When the // // user chooses add assignment they may add as many assignments they wish. // // use lines 61-68 to implement for Tuesday // // 3: use lines 70-74 to implement the display assignments functionality // // // // On Tuesday we will ensure that we do not add two Assignments with the same name // // // //******************************************************************************************// //******************************************************************************************// // // // This is your Homework For Tuesday 12/01/2020 // // 1: Edit display function as indicated in the display function below. // // 2: Update all function prototypes and headers to pass the vector // // by referenceto all functions// // 3: Implement the edit assignment functionality as per the edit function pseudo // // code listed below. // // 4: implement the load data and save data functions. When the menu is called // // load the assignment records from assignments.dat file. When the program exits // // save all the assignments to assignments.dat file. Use the file format // // listed with the load and save data function pseudo code below. // // 5: Modify the addAssignment() function to ensure that we do not add two // // Assignments with the same name. Change the function name to add_Assignment // // and pass the vector to the functions as a reference parameter // //******************************************************************************************// //an example of overloading //void setAssignmentValues(Assignment&); -- do not use: just an example Assignment add_Assignment(vector& myAssignments); void displayAssignment(Assignment& assignment); void calc_Grade(Assignment[], int&); double calcCategoryScore(Assignment myAssignments[], int& SIZE, string cat); void mainMenu(); void addAssignment(vector& myCourseGrades); //example of function overloading //two functions with the same name but different parameter lists void displayAssignment(vector& myCourseGrades); //Prototypes for editAssignments, loadData, saveData functions void loadData(vector& myCourses); void saveData(vector& myCourses); void editAssignment(vector& myCourses); bool if_Exists_Title(vector& myAssignments, string& title); //data input functions --with validation string getTitle(vector& myAssignments); double getScore(); string getCategory(); void bubbleSortArray(int array[], int size); void bubbleSortAssignments(vector& array); void editAssignment_member(vector& myCourses, int item); int main() { const int SIZE = 3; //the total number of assignments Assignment myAssignment[SIZE]; myAssignment[1].setTitle("Test"); //call the menu function mainMenu(); return 0; } /* This function creates an Assignment object, prompts the user to enter the required Title, Category, and Score. It returns the object to the calling function. */ //Modify this functions as follows: //Rename yo add_Assignment and pass the vector of //Assignments as a reference parameter. //Ensure that a title is only added once Assignment add_Assignment(vector& myAssignments) { Assignment assignment; string input; //gets input from the user double score; //clear the screen system("cls"); cout < "\n\nconfiguring="" assignment:\n";="" get="" the="" title="" assignment.settitle(gettitle(myassignments));="" get="" the="" category="" assignment.setcategory(getcategory());="" get="" the="" score="" assignment.setscore(getscore());="" display="" assignment="" displayassignment(assignment);="" system("pause");="" return="" assignment;="" }="" end="" of="" addassignment="" function="" that="" returns="" an="" assignment="" object="" prompts="" user="" for="" title="" and="" validates="" input="" is="" not="" already="" in="" use="" string="">& myAssignments) { string title; cin.ignore(100, '\n'); //flushes the buffer cout < "\nplease="" enter="" the="" name="" of="" the="" assignment(nospaces):="" ";="" cin="">> title; //validates that the title entered is not already in the vector while (if_Exists_Title(myAssignments, title)) { cout < "\ntitle="" in="" use.="" please="" enter="" a="" new="" title:="" ";="" cin="">> title; } return title; //assigns the new title } string getCategory() { string input; cin.ignore(100, '\n'); //flushes the buffer since working with strings cout < "\nplease="" enter="" the="" category="" for="" the="" assignment="" (lowercase):"=""><"\n final="" ||="" midterm="" ||="" quiz="" ||="" project="" ||="" homework="" ||="" ica="" "="">< "\nenter="" the="" category:="" ";="" cin="">> input; //validate Category while (input != "final" && input != "midterm" && input != "quiz" && input != "project" && input != "homework" && input != "ica") { cout < "\nincorrect.="" please="" try="" again:="" ";="" cin="">> input; } return input; } double getScore() { double score; cin.ignore(100, '\n'); //flushes the buffer since working with strings cout < "\n\nplease="" enter="" a="" score="" for="" this="" assignment="" between="" 0="" and="" 100:="" ";="" cin="">> score; //validate Score while (score < 0="" ||="" score="">100) { cout < "\nincorrect.="" please="" try="" again:="" ";="" cin="">> score; } return score; } //This funtions searchs a vector of Assignments for the title passed //and returns true if found or false if not bool if_Exists_Title(vector& myAssignments, string& title) { bool found = false; int i = 0; while (!found && i < myassignments.size())="" {="" if="" (myassignments.at(i).gettitle()="=" title)="" found="true;" i++;="" }="" return="" found;="" }="" this="" functions="" displays="" a="" single="" assignment="" void="" displayassignment(assignment&="" assignment)="" {="" cout="">< "\n\nassignment="" updated:\ntitle:="" "="">< assignment.gettitle()="">< "="" category:="" "="">< assignment.getcategory()="">< "="" score:="" "="">< assignment.getscore()="">< "\n";="" }="" modify="" this="" calc_grade="" function="" to="" make="" it="" behave="" the="" way="" you="" want="" it="" to.="" void="" calc_grade(assignment="" myassignments[],="" int&="" size)="" {="" double="" classscore="0;" double="" exam_mid,="" exam_fin,="" quiz,="" homework,="" ica,="" project;="" calculate="" final="" exam_fin="FINAL" *="" (calccategoryscore(myassignments,="" size,="" "final"));="" exam_mid="MIDTERM" *="" (calccategoryscore(myassignments,="" size,="" "midterm"));="" quiz="" +="QUIZ" *="" (calccategoryscore(myassignments,="" size,="" "quiz"));="" homework="" +="HOMEWORK" *="" (calccategoryscore(myassignments,="" size,="" "homework"));="" ica="" +="ICA" *="" (calccategoryscore(myassignments,="" size,="" "ica"));="" project="" +="PROJECT" *="" (calccategoryscore(myassignments,="" size,="" "project"));="" cout="">< "the="" class="" score="" is="" "="">< classscore="">< ". you earned a letter grade of "; classscore = exam_mid + exam_fin + quiz + homework + ica + project; } //end of calc_grade function /*this function takes an array of assignments, the size of the array, and category to sum and returns the average of the category. */ double calccategoryscore(assignment myassignments[], int& size, string cat) { int numofassignments = 0; //the number of assignments ".="" you="" earned="" a="" letter="" grade="" of="" ";="" classscore="exam_mid" +="" exam_fin="" +="" quiz="" +="" homework="" +="" ica="" +="" project;="" }="" end="" of="" calc_grade="" function="" *this="" function="" takes="" an="" array="" of="" assignments,="" the="" size="" of="" the="" array,="" and="" category="" to="" sum="" and="" returns="" the="" average="" of="" the="" category.="" */="" double="" calccategoryscore(assignment="" myassignments[],="" int&="" size,="" string="" cat)="" {="" int="" numofassignments="0;" the="" number="" of="">
Apr 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here