Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROGRAM SPECIFICATIONS Using separate source (Student.cpp) and header files (Student.h) create a class to represent students according to the following specifications (use the method and

image text in transcribedimage text in transcribed

PROGRAM SPECIFICATIONS Using separate source (Student.cpp) and header files (Student.h) create a class to represent students according to the following specifications (use the method and attribute names as given here): The Student.h header file (you may not alter this file and you must submit it with your code): #pragma once #include #include using namespace std; class Student private: string major; int credits; public: Student(string m = "General Studies", int c = 0); Student(Student& s); -Student(); const string getMajor(); const int getCredits(); const void getStatus(string& m, int& c); void setMajor(string m); void setCredits(int c); void setStatus(string m, int c); string displayStudent(); 1. Fields a. -major: string b. -credits: int 2. Methods (no additional ones may be created), all public a. parameterized constructor with initialized parameters i. sets major to "General Studies" ii. sets credits to 0 1. Note that these are both set in the prototype, but not in the .cpp file 2. In the .cpp file you should be setting major and credits to the input from the parameters iii. displays: Constructor has been called! " b. copy constructor that performs a deep copy i. assign the passed in object's fields to the new object's fields c. destructor i. displays Destructor called for major! " 1. where is replaced with the appropriate value ii. sets major to None" iii. sets credits to - 1 d. const string getMajor i. returns major e. const int getCredits i. returns credits f. const void getStatus i. returns both credits and major by reference g. void setMajor i. takes one string parameter ii. sets major to parameter value h. void setCredits i. takes one int parameter ii. sets credits to parameter value i. void setStatus i. take one int and one string parameter ii. sets both credits and major to respective parameter values j. string displayStudent i. takes no parameters ii. returns a string 1. "I'm a credit hours. " 2. where and are replaced with the appropriate values 3. Main Function (this goes in its own source file Main.cpp) a. Declare a single student object, sl, during declaration initialize it to have the major Computer Science" i. do not provide a value for number of credit hours ii. call the displayStudent from sl object to print its data to screen b. declare a vector of 5 objects of the student class i. Ask the user to input the major and credit hours for each student ii. Verify that the credit hours are >= 0 iii. Use an iterator to call the displayStudent function for each student object in the vector after you have collected and set all of the input

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions