BEST代写-线上留学生作业代写 & 论文代写专家

成立于2015年的老牌留学生代写品牌-BEST代写提供超过百门冷热门留学学科的作业和论文代写服务。全网BEST原创,高质,准时的留学生代写。

C++代写 | COMP 2404 – Assignment #2

C++代写 | COMP 2404 – Assignment #2

这个作业是用C++完成学生课程管理系统C++代写

COMP 2404 – Assignment #2

1. Goal
For this assignment, you will write a C++ program to manage the data for a school with students and courses.
You will implement your program using objects from the different object design categories, based on a UML class diagram provided for you.
Your program will implement several new classes representing a school, and its students and courses.
Naturally, we want our class design to show that students take courses, and courses contain students.
However, there is more than one way to design the relationship between student and course objects.
3.2. Modify the Student class
You will begin with the Student class that we worked on during the lectures. You can find this class in the coding example posted in cuLearn, in section 3.1, program #4.
You will make the following modifications:
3.2.1. implement a getter member function for the student number
3.2.2. implement the lessThan() member function, as indicated in the UML diagram. This function compares the student on the left-hand side (the this student) with the student passed in as the parameter; a student is considered “less than” another if their name comes first in alphabetical order; you can use the string class less-than operator for this
3.3. Implement the Course class
You will implement a new Course class that contains the following data members, as indicated in the UML diagram:
3.3.1. the unique identifier of the course
3.3.2. the subject of the course; for example, the subject of this course is “COMP”
3.3.3. the course code; for example, the code for this course is 2404
3.3.4. the course section
3.3.5. the term when the course was offered; you can represent this using the first letter of the semester,followed by the last two digits of the year; for example, “F20” and “W21” would be the valid terms for this academic year
3.3.6. the course instructor
The Course class will contain the following member functions:
3.3.7. a constructor that takes an identifier, a course subject, code, section, term, and instructor as parameters, and initializes all the data members
3.3.8. a getter function for the course id
3.3.9. a getCourseCode() function that concatenates the course subject and code, and returns this value; for example, the value returned for this course would be “COMP2404”
3.3.10. a lessThan() member function that compares the course on the left-hand side (the this course) with the course passed in as the parameter; a course is considered “less than” another according to the following rules, applied sequentially:
(a) order by subject
(b) if the two subjects are the same, order by course code
(c) if the two course codes are the same, order by term
(d) if the two terms are the same, order by section
3.3.11. a print() function that prints to the screen all the course information
©2020 Christine Laurendeau COMP 2404 :: Fall 2020 :: Assignment #2 2/6
3.4. Implement the Taken class
You will implement a new Taken class that contains the following data members:
3.4.1. a pointer to the Student object representing the student that has taken the course
3.4.2. a pointer to the Course object representing the course taken by the student
3.4.3. the grade earned by the student in the course, represented as a letter grade
The Taken class will contain the following member functions:
3.4.4. a constructor that takes a student pointer, a course pointer, and a grade as parameters, and initializes all the data members
3.4.5. a getter function for the Student pointer
3.4.6. a getter function for the Course pointer
3.4.7. a print() function that prints to the screen the corresponding student’s name, the concatenated course code (subject and code), and the grade earned
3.5. Implement the DynArray class
You will modify the Array class that we implemented in the coding example of section 2.2, program #1.
You will rename this class to DynArray, and you will modify it as follows:
3.5.1. modify the array to be a dynamically allocated array of Student pointers
(a) you can refer to the coding example in section 1.6, program #5, for examples of the four different kinds of arrays
3.5.2. modify the constructor and destructor accordingly; you can assume a fixed size for the capacity
3.5.3. modify the print() member function as required
3.5.4. modify the add() function as follows:
(a) take a Student pointer as parameter
(b) add the given student to the array in its correct place, in ascending (increasing) order
(i) you must shift the elements in the array towards the back of the array to make room for the new element in its correct place; do not add to the end of the array and sort; do not use any sorting function or sorting algorithm
(ii) you must use the Student class lessThan() function to perform the comparison
3.5.5. implement a bool find(string num, Student** stu) function that searches the array to find the student with the number indicated in the num parameter, and returns the corresponding student in the stu parameter; this function returns true if no errors occurred, and false otherwise
3.6. Implement the StatArray class
You will modify the Array class that we implemented in the coding example of section 2.2, program #1.
You will rename this class to StatArray, and you will modify it as follows:
3.6.1. modify the array to be a statically allocated array of Course pointers
(a) you can refer to the coding example in section 1.6, program #5, for examples of the four different kinds of arrays
3.6.2. modify the print() member function as required
3.6.3. modify the add() function as follows:
(a) take a Course pointer as parameter
(b) add the given course to the array in its correct place, in ascending (increasing) order
(i) you must shift the elements in the array towards the back of the array to make room for the
new element in its correct place; do not add to the end of the array and sort; do not use
any sorting function or sorting algorithm
(ii) you must use the Course class lessThan() function to perform the comparison
3.6.4. implement a bool find(int id, Course** c) function that searches the array to find the course with the identifier indicated in the id parameter, and returns the corresponding course in the c parameter; this function returns true if no errors occurred, and false otherwise
©2020 Christine Laurendeau COMP 2404 :: Fall 2020 :: Assignment #2 3/6
3.7. Implement the School class
You will implement a new School class that contains the following data members:
3.7.1. the school name
3.7.2. the collection of all students in the school, stored as a DynArray object
3.7.3. the collection of all courses in the school, stored as a StatArray object
3.7.4. the collection of student-course pairs, representing which students have taken which courses; this
collection will be stored as a statically allocated array of Taken object pointers
3.7.5. the number of elements in the Taken collection
The School class will contain the following member functions:
3.7.6. a default constructor that takes a school name as parameter, and initializes all the data members
3.7.7. a destructor that deallocates the required dynamically allocated objects
3.7.8. an addStu() member function, as indicated in the UML diagram, that adds the given student to the student collection
3.7.9. an addCourse() function that adds the given course to the course collection
3.7.10. an addTaken() function that does the following:
(a) find the student object with the given student number
(b) find the course object with the given course id
(c) create a new Taken object with the found student and course objects, and with the given grade
(d) add the new object to the back of the Taken collection
NOTE #1: all error checking must be performed, and all errors must be handled
NOTE #2: existing functions must be reused everywhere possible
3.7.11. a printStudents() function that prints all the students in the student collection
3.7.12. a printCourses() function that prints all the courses in the course collection
3.7.13. a printTaken() function that prints all the Taken objects in the collection
3.7.14. a printTakenByStu() function that prints the full course information for every course taken by the
given student, along with the grade earned by the student in that course
3.8. Implement the Control class
A skeleton Control class has been provided for you, and it is posted in cuLearn in the a2-posted.tar file. You will implement the Control class so that it contains the following data members:
3.8.1. the School object to be managed
3.8.2. the View object that will be responsible for most user I/O; the View class is provided for you
The Control class will contain the following member functions:
3.8.3. a default constructor that initializes the data members
3.8.4. an initStudents() member function that initializes the students contained in the school
3.8.5. an initCourses() member function that initializes the courses contained in the school
3.8.6. a launch() function that implements the program control flow and does the following:
(a) call the initialization functions
(b) use the View object to display the main menu and read the user’s selection, until the user exits
(c) if required by the user:
(i) print out all the students in the school
(ii) print out all the courses in the school
(iii) print out all the Taken objects in the school’s collection
(iv) print out all the courses taken by a specific student, and the grades earned; this will require using the View object to read from the user the student number
(v) add a new Taken object for a specific student and course; this will require using the View object to read from the user the student number, the course id, and the grade earned
©2020 Christine Laurendeau COMP 2404 :: Fall 2020 :: Assignment #2 4/6
NOTE: Both initialization functions have been provided for you. You must use these functions, without modification, to initialize the data in your program.

bestdaixie

评论已关闭。