Question
i did what i could check the bottom please help me complete the rest. PART 1: build and test a simple class Create a class
i did what i could check the bottom please help me complete the rest.
PART 1: build and test a simple class Create a class that represents a Course. Attributes are: ? Course id (such as CS116 assume no spaces in course id) ? Number of credits - integer ? Letter grade char Functions: ? a default constructor ? a parameterized constructor that sets course id, credits, grade ? approprate set/get functions for each of the attributes Make sure to TEST THIS CLASS before moving on: ? create an object ? store values ? make sure you can retrieve the values PART 2: Using Composition Create a Student class to store information a student and the courses they have taken. A Student may have multiple courses on their transcript. Attributes are: ? student name (just use a single name if you are not clear about getline issues) ? student id number (an integer) ? A list of courses represented by a vector of Course type Functions ? a default constructor ? a parameterized constructor that receives the name and id number ? set and get methods for name ? set and get methods for id number ? addCourse function (receives name, credits, grade OR a Course object) ? getGPA function (calculates and returns the GPA) ? print transcript (prints the students transcript including name, courses, and GPA) A students GPA is based on the class credits and the grade in each class. Each letter grade is assigned a point value as follows: A = 4 points B = 3 points C = 2 points D = 1 point You calculate grade points for each class by multiplying the credits times the value associated with the letter grade. ? An A in a 3 unit class is equivalent to 12 grade points (4 for the A times 3 unit class) StudentRegistrationLab Page 2 ? A C in a 4 unit class is equivalent to 8 grade points (2 for the C times 4 unit class) ? This is a total of 20 grade points. ? GPA is then calculated by adding up the total grade points and dividing by the total class credits, so in this case: (4 x 3) + (2 x 4) = 12 + 8 = 20 grade points / 7 credits = 2.85 GPA Make sure to TEST this class to make sure all functions work with a single Student object (you can just hard code some test data, NO user input). ? Create a Student object ? Set the name to some value ? Set the id to some value ? Add a course, any name, 3 units, grade of A ? Add a course, any name, 4 units, grade of C ? Print the GPA (it should be 2.85 based on example above) ? Print the transcript You should NOT CONTINUE until this works (no user input, simple test). PART 3: create the app, a student registration program The app will have a vector of Student type. It has a main menu, and a student menu. You must PLAN this code before you start! Think about the best way to modularize the code. For full credit, you must create FUNCTIONS in your app to handle the options (not all code in main!). Work on ONE thing at a time. Make a test plan of how you will approach and test this program! Main menu options: 1 Register a new student Add a new student to the vector. Prompt for name. Assign an ID number (your program should start with 1001 and assign numbers sequentially) 2 - Returning student Input the ID number and search the vector for this particular student. If you find the student, offer the student options and update information for that student. If not found, give message. Student menu options are: 1 - Add class Add a class to that particular student. Prompt for class name, credits, and grade 2 - Check GPA Display the students GPA 3 - Print transcript Print the transcript of all courses and grades for this student and GPA StudentRegistrationLab Page 3 Here is a sample run to demonstrate basic functionality of the menu options. It is NOT a complete test. You should create your own testing scenario to prove that your system works! For example, you need to demonstrate adding multiple classes to a student at different times, dealing with multiple students. MAIN MENU 1 New student 2 - Returning student 3 - Quit Enter choice: 1 Enter name: Prof P Prof P you are registered! Student number is 1001. MAIN MENU 1 New student 2 - Returning student 3 - Quit Enter choice: 1 Enter name: Joe Smith Joe Smith you are registered! Student number is 1002. MAIN MENU 1 New student 2 - Returning student 3 - Quit Enter choice: 2 Enter ID: 1001 Welcome Prof P! STUDENT MENU 1 - Add class 2 - Check GPA 3 - Print transcript 4 - Quit Enter choice: 3 You have no courses STUDENT MENU 1 - Add class 2 - Check GPA 3 - Print transcript 4 - Quit Enter choice: 1 Course ID? CS102 Units? 3 Grade? B Course added STUDENT MENU 1 - Add class 2 - Check GPA StudentRegistrationLab Page 4 3 - Print transcript 4 - Quit Enter choice: 2 Your GPA is 3.00 STUDENT MENU 1 - Add class 2 - Check GPA 3 - Print transcript 4 - Quit Enter choice: 3 Transcript for: Prof P ========================== Course Grade CS102 B GPA: 3.00 STUDENT MENU 1 - Add class 2 - Check GPA 3 - Print transcript 4 - Quit Enter choice: 4 Goodbye Prof P! MAIN MENU 1 New student 2 - Returning student 3 - Quit Enter choice: 2 Enter ID: 1010 Sorry, 1010 is not a valid student ID MAIN MENU 1 New student 2 - Returning student 3 - Quit Enter choice: 3 Goodbye!
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This is what i have so far i need help finising the rest:
Part A:
#include
using namespace std;
class Course // class with its data members and member functions
{
string course_id;
int credits;
char letter_grade;
public: // access specifier
Course() //default constructor
{
}
Course(string a, int b, char c) //parameterized constructor
{
course_id=a;
credits=b;
letter_grade=c;
}
void get();
};
void Course::get() // member of the class should be accessed outside with ::
{ // scope resolution operator
cout<<"Obtained "<
}
int main()
{
Course obj("CS116",3,'A'); // creating the object and calling the constructor
obj.get();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started