I am working on a basic c class project that is asking for t
I am working on a basic c++ class project that is asking for the following...
*********************************************************************************************
Make a “Contact” class and write code to demonstrate all of its functions.
Required features:
 •   Your Contact class should have at least these member variables: FirstName, LastName, Email, Telephone, and Notes. These member variables (also called member fields) should be private, not public. You should use the string data type (not C-strings) for the text-based variables, and you can choose how you wish to store the telephone number.
 •   Your Contact class should provide public    get ()   and   set () functions to access and change each of the private member variables. For example, string Contact::getFirstName(), void Contact::setFirstName(string s), string Contact::getEmail(), void Contact::setEmail(string s), etc.
 •   For the telephone number field, if a user attempts to enter a number in any 7 or 10 didgit format, your   setTelephone() function should be able to recognize it and correctly enter it into your Contact class, so that it can be printed out in this format: (479) -123-4567
 
 If a user enters a telephone number with any number of digits other than 10 digits or 7 digits, your code should print out an error message and the telephone field should not be changed. If the user enters only 7 digits, your code should add the 479 area code. (Hint: write code to first remove all non-numeric characters (including whitespace) from the entered string, then count the number of digits remaining, then process each digit accordingly…)
 •   For the email field, if the user enters an email address which is missing an “@” character, your code should print out an error message and the email field should not be changed.
 •   Your Contact class should have a public member function called printContact(), which prints out all the information for that contact in a nicely formatted way.
 o   Your main() function should test your Contact class by creating at least three Contact objects, filling each one with information, and placing the objects into a vector called ContactBook (for example, using push_back() three times). To fill the Contact objects, you can either input information from the user (more realistic), or have the input information coded into the main() function (easier for repeated testing). Finally, your main() function should have a loop which prints out all the contact information by calling the printContact() member function of each Contact object in the ContactBook vector.
****************************************************************************************************************************************************************************************************************
So far this is what I have for my c++ code.
#include <iostream>
 #include <string>
 #include <fstream>
 #include <vector>
 using namespace std;
//Class for phonebook contact
 class contact
 {
 public:
     contact();
     string getFirstName(char), getLastName(char), getEmail(char), getNote();
     char gettelephone();
     void setFirstName(), setLastName(), setEmail(), setNote();
     char settelephone();
     std::vector<string> ContactBook();
     string printContact(ContactBook);
private:
     string FirstName();
     string LastName();
     string Email();
     char telephone();
     string Note();
 };
int main()
 {
     contact c1, c2, c3;
     c1.setFirstName = \"Daniel\";
     c1.setLastName = \"Jackson\";
     c1.setEmail = \"arch@sgc.gov\";
     c1.setNote = \"Personal info\";
     c1.settelephone = (479) 554-6411;
     ////////////////////////////
     c2.setFirstName = \"Jack\";
     c2.setLastName = \"O\'Niell\";
     c2.setEmail = \"onielj@sgc.gov\";
     c2.setNote = \"Doh!\";
     c2.settelephone = 50366855;
     ////////////////////////
     c3.setFirstName = \"Sam\";
     c3.setLastName = \"Carter\";
     c3.setEmail = \"cater@sgc.gov\";
     c3.setNote = \"super nova\";
     c3.settelephone = 418-555-8354;
     ///////////////////////////////
     printContact(c1) << endl;
     printContact(c2) << endl;
printContact(c3) << endl;
}
 string contact::printContact()
 {
   
 }
string contact::getFirstName()
 {
     return ? ? ? ;
 }
 void contact::setFirstName()
 {
     return ? ? ? ;
 }
 string contact::getLastName()
 {
     return ? ? ? ;
 }
 void contact::setLastName()
 {
     return ? ? ? ;
 }
 string contact::getEmail()
 {
     return ? ? ? ;
 }
 void contact::setEmail()
 {
     return ? ? ? ;
 }
 string contact::getNote()
 {
     return ? ? ? ;
 }
 void contact::setNote()
 {
     return ? ? ? ;
 }
 char contact::gettelephone()
 {
     return;
 }
 char contact::settelephone()
 {
     return;
 }
****************************************************************************************************************************************
I am getting stuck on the difference between the set and get function and how the printContact and ContactBook vector works.
I\'d appreciate any help.
Solution
#include <iostream>
 #include <string>
 #include <fstream>
 #include <vector>
 using namespace std;
 //Class for phonebook Contact
 class Contact
 {
 public:
    string getFirstName();
    string getLastName();
    string getEmail();
    string getNote();
    string getTelephone();
    void setFirstName(string fn);
    void setLastName(string ln);
    void setEmail(string e);
    void setNote(string n);
    void setTelephone(string t);
    std::vector<string> ContactBook;
    void printContact();
 private:
    string FirstName;
    string LastName;
    string Email;
    string Telephone;
    string Note;
};
 int main()
 {
    std::vector<Contact> ContactBook;
    Contact c1, c2, c3;
    c1.setFirstName(\"Daniel\");
    c1.setLastName(\"Jackson\");
    c1.setEmail(\"arch@sgc.gov\");
    c1.setNote(\"Personal info\");
    c1.setTelephone(\"(479) 554-6411\");
    ContactBook.push_back(c1);
 ////////////////////////////
    c2.setFirstName(\"Jack\");
    c2.setLastName(\"O\'Niell\");
    c2.setEmail(\"onielj@sgc.gov\");
    c2.setNote(\"Doh!\");
    c2.setTelephone(\"50366855\");
    ContactBook.push_back(c2);
 ////////////////////////
    c3.setFirstName(\"Sam\");
    c3.setLastName(\"Carter\");
    c3.setEmail(\"cater@sgc.gov\");
    c3.setNote(\"super nova\");
    c3.setTelephone(\"418-555-8354\");
    ContactBook.push_back(c3);
 ///////////////////////////////
    c1.printContact();
    c2.printContact();
    c3.printContact();
 }
 void Contact::printContact()
 {
    cout << \"FirstName: \" << FirstName << \", Last Name: \" << LastName << \", Email: \" << Email << \", Note: \" << Note << \", Telephone: \" << Telephone << \"\ \";
 }
 string Contact::getFirstName()
 {
    return FirstName;
 }
 void Contact::setFirstName(string fn)
 {
    FirstName = fn;
 }
 string Contact::getLastName()
 {
    return LastName;
 }
 void Contact::setLastName(string ln)
 {
    LastName = ln;
 }
 string Contact::getEmail()
 {
    return Email;
 }
 void Contact::setEmail(string e)
 {
    Email = e;
 }
 string Contact::getNote()
 {
    return Note;
 }
 void Contact::setNote(string n)
 {
    Note = n;
 }
 string Contact::getTelephone()
 {
    return Telephone;
 }
 void Contact::setTelephone(string t)
 {
    Telephone = t;
 }





