File name: person.cpp #include <iostream> #include <string> #include \"person.h\
ID: 3623557 • Letter: F
Question
File name: person.cpp
#include <iostream>
#include <string>
#include "person.h"
using std::string;
using std::cout;
using std::ostream;
ostream& operator<<(ostream& s, const person& p) {
return s<< p.first_name << + " " + p.middle_name + " " + p.last_name;}
int main()
{
person p("WIll","Christopher","Smith");
person q(p);
person s(p);
cout << p.full_name() << " ";
cout << q.full_name() << " ";
cout << s.full_name() << " ";
return 0;
}
File name:person.h
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::ostream;
class person
{
person(string);
private:
string first_name;
string middle_name;
string last_name;
public:
person(string fn, string mn, string ln)
{ first_name = fn;
middle_name = mn;
last_name = ln;}
string full_name(){return first_name + " " + middle_name + " " + last_name;}
person(const person& another_person):
first_name(another_person.first_name),
middle_name(another_person.middle_name),
last_name(another_person.last_name){}
friend ostream& operator<<(ostream& s, const person& p);
};
Explanation / Answer
class SSN() private: Integer firstthree; Integer two; Integer four; public: Integer total = four + two * 10000 + firstthree * 1000000; class PhoneNumber() private: Integer Areacode; Integer three; Integer four; public: Text number = "(" + Areadcode + ") " + three + "-" + four; class Birthday() Integer month; Integer day; Integer year; public Text Birthday = month + "/" + day + "/" + year;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.