CSE 1325 Homework 3 solved

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (9 votes)

Part 1 – Course
In this part, you will create the class (both .h and .cpp files) for a Course Class. This will be the basis for
our project. See the UML Class Diagram below.
Here is a description of all the variables and functions.
Variables
• course_prefix – The prefix of the course. The “CSE” in “CSE 1325 – 1″
• course_number – The course number of the course. The “1325” in “CSE 1325 – 1″
• section_number– The section number of the course. The “1” in “CSE 1325 – 1”
• name – The name of the course
• instructor – the name of the instructor of the course
• student_ids – a list of students ids for the students enrolled in the course. List is sorted
numerically by ids.
Functions
• Course() – The Default Constructor for the Course Class. Make all values “” or 0 depending on
type.
• Course(string, int, int, string, string) – Constructor for the Course Class. It assigns the values to
the fields within the class
• Get functions – 6 functions that return the private fields from the class
• Set functions – 5 functions that set the value of the fields from the class
• add_student – adds a student to the list. If student is already enrolled, display error message
and do not double enroll student
• remove_student – removes a student from the list. If student is not enrolled, display error
message.
• To_string() – returns a string containing the values of all the private fields (You choose format).
• operator<< – output the private fields to an output stream. Make it readable formated output
(You choose format)
• operator< – used for sorting in later homework assignments. Returns true if lhs.prefix <
rhs.prefix. If ==, then move to course number. If ==, then move to section. There can not be a
duplicate course that has all 3 the same.
Part 2 – main.cpp
Have your main function do the following. This main is mainly testing all the functionalities we just
programmed above.:
• Create a Course with default values
• Output that Course (cout << course)
• Using the mutator methods, change the values of the Course.
• Output the Course again.
• Output the result of all the get functions for the Course.
• Add a student to the course
• Add another student to the course (lower id than the first student)
• Add another student to the course (Same id as one of the two before)
• Output the Course again
• Remove one of the students from the course
• Remove another student from the course (one not enrolled in the course)
• Output the Course Again
• Output the to_string function for the Course
• Create a second course using the non-default constructor that is “less than” the first course
• Output second course
• Display the result of course 1 < course 2
• Create a third course using the non-default constructor that is “greater than” the first course
• Output third course
• Display the result of course 1 < course 3
• Output the result of first account < second account
Part 3 – makefile
You are REQUIRED to provide a simple makefile that can build AND execute your program given the
command “make”. The sample code from lecture 5 is a good example of a makefile to use for the
homework. The only command the GTA will type is “make” to run and execute your program.
Deliverables
You will submit your code via Canvas. You will upload a zip file, named “abc1234_HW3.zip”, containing
the following file structure:
• abc1234
o abc1234_Course.h
o abc1234_Course.cpp
o abc1234_main.cpp
o makefile
Full credit files named incorrectly will result in a loss of 5 points each. Failure to follow proper file
structure will result in a loss of 5 points.