Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CSCE 1040 Homework 2 For this assignment we are going to build a simple Grade Bo

ID: 3752635 • Letter: C

Question

CSCE 1040 Homework 2 For this assignment we are going to build a simple Grade Book using classes For the purposes of this grade book you should first provide a menu with the following options 1. Add a new course 2. Add a new student 3. Add a student to a course (add enrollment) 4. Add grades for a student in a course 5. Print a list of all grades for a student in a course 6. Print a list of all students in a course 7. Compute the average for a student in a course 8. Print a list of all courses 9. Print a list of all students 10. Compute the average for a course 11. Store Grade book (to a disk file) 12. Load Grade book (from a disk file) Each of these menu items should correspond to a function you will write For this program you will create a class to represent each of the basic entities, as we as a class to represent each of the collections. For the collections you should use a dynamically-sized arrays of objects Student should have an ID, a name, and a classification and any other fields you need Course should have and ID, a name, a location and a meeting time and any other fields you feel are necessary Enrollment should have a ID, a student ID, a course ID and a list of up to 10 grades, an average grade and a letter grade based on a standard 90/80/70 grading rubric with rounding Grades will be whole numbers only (no fractional part). Averages will be saved and displayed as floating point values to the hundredths position

Explanation / Answer

//Hey. Here is your solution

// if it helps, please do upvote. Thank You.

// Given below are 4 files viz Course.h, Course.cpp, Student.h, Student.cpp

// It will make fundamental ready for the assignment. Covering task 1 to 5 as per question.

// This is course.h file

#ifndef Course_H

#define Course_H

#include <string>

// This is course.h file

#include <stdio.h>

#include "Student.h"

class Course

{

public:

Course(string cName); // default constructor

~Course(); // destructor

void addStudent(Student stud);

void printStudentAllGrade();

const static int MAX_STUDENTS = 48;

int MAX_GRADE = 10; //Its assumed in absense of information

int numberOfStudents;

string courseName;

// This will hold student as student class object

Student students[MAX_STUDENTS];

// This will hold grade for every student in a class based on index;

int gradeArray[MAX_STUDENTS][10];

};

#endif

//#################################################

// Course.cpp file

#include <string>

#include <iostream>

#include <stdio.h>

#include "Course.h"

using namespace std;

Course::Course(string cName)

{

courseName = cName;

}

Course::~Course()

{}

void Course::addStudent(Student stud)

{

if (numberOfStudents == MAX_STUDENTS)

cout << "Class can not have more than 48 students";

else

{

students[numberOfStudents + 1] = stud;

}

}

void Course::printStudentAllGrade()

{

for (int i = 0; i < numberOfStudents; i++)

{

for (int j = 0; j < 10; i++)

{

cout << " Student Name - " << students[i].getName() << " Grade - " << gradeArray[i][j];

}

}

}

//###################################################

//This is Student.h file

#ifndef STUDENT_H

#define STUDENT_H

#include <string>

#include <iostream>

#include <stdio.h>

using namespace std;

class Student

{

public:

Student(); // default constructor

Student(string n, int g); // constructor

~Student(); // destructor

void setName(string name); // mutator function

void setGrade(int g); // mutator function

void setEnroll(); // mutator function

string getName() const; // accessor function

int getGrade() const; // accessor function

private:

const static int MAX_CLASS = 5;

int totalEnrollClass;

string name;// holds the student name

int grade;// holds the student grage

};

#endif

//########################################

//This is student.cpp file

#include <string>

#include <iostream>

#include <stdio.h>

#include "Student.h"

using namespace std;

Student::Student()

{

}

Student::Student(string n, int g) : name(n), grade(g)

{}

Student::~Student()

{}

void Student::setName(string name)

{

this->name = name;

}

void Student::setGrade(int g)

{

grade = g;

}

void Student::setEnroll()

{

totalEnrollClass++;

}

string Student::getName() const

{

return name;

}

int Student::getGrade() const

{

return grade;

}