Question: Use c++, don't use pointers Use separate source files and header files to create a class to represent students. A student object has attributes of

Use c++, don't use pointers

Use separate source files and header files to create a class to represent students.

  1. A student object has attributes of major (string) and credit hours taken (integer).
  2. Member functions (methods) are as follows (no additional ones may be created):
    1. Using a constructor initializer list, create a constructor with default parameter values of General Studies and -1, and that displays \tConstructor called for major and hours , replacing and with attribute values.
    2. individual const get methods (in-line definition) for each attribute
    3. a const get method (NOT in-line) that uses pass-by-reference for both parameters and has return-type void
    4. one set method (NOT in-line) that sets both attributes
    5. PrintMe method (NOT in-line) that returns string Im a major and have completed credit hours., replacing and with the appropriate attribute values
    6. Destructor (in-line) that displays \tDestructor called for major. , replacing with the appropriate attribute value

Write a complete program that uses the student class you created and tests its functionality:

  1. Declare a single student object and during declaration initialize it to have major Astrophysics; do not provide a value for number of credit hours
  2. Call the PrintMe method of the single student object and display to the screen/console
  3. Ask the user for the name of a file to which output should be written
  4. Declare a vector of 5 objects of student class
    1. Ask the user for 5 majors and 5 credit hours and assign them to each student in the vector. The credit hours must be verified as non-negative or else get another number. This must be tested in your output.
    2. Open the file and write to it using the value returned by PrintMe for every student in your vector
  5. Explicitly close the output file
  6. Any other tests you deem appropriate to prove your program works perfectly

In order to properly capture the destructor messages, put a breakpoint on the return statement in main. When the program pauses at that line, press F10 once, capture the output screen as a snippet, then press F5 to finish execution.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!