Question

In this assignment, you will create a class, Student, derived from the Person class. You will also thoroughly test your class to verify that everything you want it to do is done correctly and efficiently.

//Private member data:
//    1. m_gpa: grade point average (float).
//Public functions:
//    1. Student(), Student(const char * name, int age, const string &ssn,
//       float gpa), Student(const Student &s)
//    2. Provide "accessor" and "mutator" functions for
//       each of the member data items in the class.
//    3. Overload the input and output operators for the class.

Tested thoroughly means:

All constructors tested.
All accessor and mutator functions tested.
All overloaded operators tested.
Specific to input and output operators:
a. Tested for both “common” I/O and file I/O.
b. For file I/O, write out at least two objects to a file, read the objects back into different variables. Verify that the corresponding objects are indeed the same.
Test a “const” object to make sure all operations possible on a “const” object function as required.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#ifndef PERSON_H
#define PERSON_H

#include <cstring>
#include <string>
#include <iostream>

using namespace std;

const int NAME_LEN = 80;

class Person {
public:
    //Public functions:
    //    1. Person(), Person(const char * name, int age, const string &ssn),
    //       Person(const Person &p)
    //    2. Destructor.
    //    3. Overloaded assignment operator.
    //    4. As discussed in class, provide "accessor" and "mutator" functions for
    //       each of the member data items in the class.
    //    5. Overloaded input and output operators.
    Person();
    Person(const char * name, int age, const string &ssn);
    Person(const Person &p);
    virtual ~Person();
   
    Person operator = (const Person &p);
   
    // accessors
    char * getName() const;
    int getAge() const;
    string getSSN() const;
   
    // mutators
    void setName(const char * name);
    void setAge(int age);
    void setSSN(const string& ssn);
   
    friend ostream &operator<<(ostream &stream, Person o);
    friend istream &operator>>(istream &stream, Person &o);...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Assisting Tutor

Related Homework Solutions

C++ Programming Questions
Homework Solution
$40.00
Computer Science
C++ Programming
Constructors
Functions
Members
Classes
Stocks
Prices
Shares
Console
Multiplication
Dates
Implementation
Departmental Majors Project
Homework Solution
$30.00
Computer Science
Programming
Visual Basic
Students
Departments
Majors
Messages
Association
Controls
Screen Captures
Text Boxes
Functions
Event Procedures
Codes
Arrays and Nested Loops
Homework Solution
$35.00
Computer Science
Programming
Arrays
Nested Loops
Rows
Columns
Double-Precision Numbers
Integers
Randomization
Patterns
Visual Basic Programming Problems
Homework Solution
$20.00
Visual Basic
Programming
Computer Science
Arrays
Salespeople
Economy
Commission
Integers
Salaries
Parameters
Statements
Variables
Loops
Functions
Programming Problems: Dice Counter
Homework Solution
$40.00
Computer Science
Programming
C#
Dice Counter
Random Numbers
Generators
Arrays
Summation
Indexes
Loops
Instances
Elements
Programming Problems: Classes and Instances
Homework Solution
$50.00
Computer Science
Classes
Instances
Programming
Students
Structures
Integers
Credits
Average Values
Points
Data
Strings
Aspect Ratio
Libraries
Get help from a qualified tutor
Live Chats