Refactor Assignment 2 into 3 project related files. Customer.h - Class Specification Customer.cpp - Class Implementation (Methods) TestCustomer.cpp - Your code that performs the logic from Assignment 2. The 3 files need to be named as listed above and should compile without errors. Deliverables are the 3 files listed above.  Assingment 2: #include #include #include using namespace std; //My main method int main() {     Customer cust;     cust.setCustomerNumber(1);     char name[NAME_SIZE];     char streetAddress_1[STREET_SIZE];     char streetAddress_2[STREET_SIZE];     char city[CITY_SIZE];     char state[STATE_CODE_SIZE];     int zipCode;     do {         cout << "Input name: ";         cin.getline(name, NAME_SIZE);     } while (!cust.setName(name));     do {         cout << "Input street address 1: ";         cin.getline(streetAddress_1, STREET_SIZE);     } while (!cust.setStreetAddress1(streetAddress_1));     do {         cout << "Input street address 2: ";         cin.getline(streetAddress_2, STREET_SIZE);     } while (!cust.setStreetAddress2(streetAddress_2));     do {         cout << "Input city: ";         cin.getline(city, CITY_SIZE);     } while (!cust.setCity(city));     do {         cout << "Input state code: ";         cin.getline(state, STATE_CODE_SIZE);     } while (!cust.setState(state));     do {         cout << "Input zip: ";         cin >> zipCode;     } while (!cust.setZipCode(zipCode));     // displaying all customer details     cout << endl << "Details of Customer: " << endl;     cout << "Customer Number: " << cust.getCustomerNumber() << endl;     cout << "Name: " << cust.getName() << endl;     cout << "Street Address 1: " << cust.getStreetAddress1() << endl;     cout << "Street Address 2: " << cust.getStreetAddress2() << endl;     cout << "City: " << cust.getCity() << endl;     cout << "State: " << cust.getState() << endl;     cout << "Zip code: " << cust.getZipCode() << endl;     return 0; } //Declaring My Function NAME_SIZE/STREER_SIZE/CITY_SIZE/STATE_CODE_SIZE const int NAME_SIZE = 20; const int STREET_SIZE = 30; const int CITY_SIZE = 20; const int STATE_CODE_SIZE = 3; //Customer Details   class Customer { private:     long customerNumber;     char name[NAME_SIZE];     char streetAddress_1[STREET_SIZE];     char streetAddress_2[STREET_SIZE];     char city[CITY_SIZE];     char state[STATE_CODE_SIZE];     int zipCode; //Public Class as Assingment required  public:     void setCustomerNumber(long cn);     bool setName(char n[]);     bool setStreetAddress1(char sa[]);     bool setStreetAddress2(char sa[]);     bool setCity(char c[]);     bool setState(char s[]);     bool setZipCode(int z);     long getCustomerNumber();     char* getName();     char* getStreetAddress1();     char* getStreetAddress2();     char* getCity();     char* getState();     int getZipCode(); }; // setters void Customer::setCustomerNumber(long cn) {     customerNumber = cn; } bool Customer::setName(char n[]) {     //Confirmed NAME is not an empty string      //using Strcpy to copy one string to another     if (strlen(n) > 0)     {         strcpy(name, n);         return true;     }     return false; } bool Customer::setStreetAddress1(char sa[]) {     // Confirmed StreetAddress1 is not an empty string     if (strlen(sa) > 0)     {         strcpy(streetAddress_1, sa);         return true;     }     return false; } bool Customer::setStreetAddress2(char sa[]) {     // Confirmed StreetAddress2 is not an empty string     if (strlen(sa) > 0)     {         strcpy(streetAddress_2, sa);         return true;     }     return false; } bool Customer::setCity(char c[]) {     // Confirmed city is not an empty string     if (strlen(c) > 0)     {         strcpy(city, c);         //all characters of city are letters         for (int i = 0; i < strlen(city); i++)         {             city[i] = toupper(city[i]);             if (city[i] < 'A' || city[i] > 'Z')                 return false;         }         return true;     }     return false; } bool Customer::setState(char s[]) {     // Confirmed state is not an empty string     if (strlen(s) > 0)     {         strcpy(state, s);         // Confirmed all characters of state are letters         for (int i = 0; i < strlen(state); i++)         {             state[i] = toupper(state[i]);             if (state[i] < 'A' || state[i] > 'Z')                 return false;         }         return true;     }     return false; } bool Customer::setZipCode(int z) {     // Confirmed zipCode is between [0,99999]     if (z >= 0 && z <= 99999)     {         zipCode = z;         return true;     }     return false; } //Printing all the outputs  long Customer::getCustomerNumber() {     return customerNumber; } char* Customer::getName() {     return name; } char* Customer::getStreetAddress1() {     return streetAddress_1; } char* Customer::getStreetAddress2() {     return streetAddress_2; } char* Customer::getCity() {     return city; } char* Customer::getState() {     return state; } int Customer::getZipCode() {     return zipCode;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Refactor Assignment 2 into 3 project related files.

Customer.h - Class Specification
Customer.cpp - Class Implementation (Methods)
TestCustomer.cpp - Your code that performs the logic from Assignment 2.

The 3 files need to be named as listed above and should compile without errors.
Deliverables are the 3 files listed above. 

Assingment 2:

#include <iostream>
#include <cstring>
#include <cctype>

using namespace std;


//My main method
int main()
{
    Customer cust;
    cust.setCustomerNumber(1);
    char name[NAME_SIZE];
    char streetAddress_1[STREET_SIZE];
    char streetAddress_2[STREET_SIZE];
    char city[CITY_SIZE];
    char state[STATE_CODE_SIZE];
    int zipCode;
    do {
        cout << "Input name: ";
        cin.getline(name, NAME_SIZE);
    } while (!cust.setName(name));
    do {
        cout << "Input street address 1: ";
        cin.getline(streetAddress_1, STREET_SIZE);
    } while (!cust.setStreetAddress1(streetAddress_1));
    do {
        cout << "Input street address 2: ";
        cin.getline(streetAddress_2, STREET_SIZE);
    } while (!cust.setStreetAddress2(streetAddress_2));
    do {
        cout << "Input city: ";
        cin.getline(city, CITY_SIZE);
    } while (!cust.setCity(city));
    do {
        cout << "Input state code: ";
        cin.getline(state, STATE_CODE_SIZE);
    } while (!cust.setState(state));
    do {
        cout << "Input zip: ";
        cin >> zipCode;
    } while (!cust.setZipCode(zipCode));

    // displaying all customer details
    cout << endl << "Details of Customer: " << endl;
    cout << "Customer Number: " << cust.getCustomerNumber() << endl;
    cout << "Name: " << cust.getName() << endl;
    cout << "Street Address 1: " << cust.getStreetAddress1() << endl;
    cout << "Street Address 2: " << cust.getStreetAddress2() << endl;
    cout << "City: " << cust.getCity() << endl;
    cout << "State: " << cust.getState() << endl;
    cout << "Zip code: " << cust.getZipCode() << endl;
    return 0;
}

//Declaring My Function NAME_SIZE/STREER_SIZE/CITY_SIZE/STATE_CODE_SIZE
const int NAME_SIZE = 20;
const int STREET_SIZE = 30;
const int CITY_SIZE = 20;
const int STATE_CODE_SIZE = 3;

//Customer Details  
class Customer
{
private:
    long customerNumber;
    char name[NAME_SIZE];
    char streetAddress_1[STREET_SIZE];
    char streetAddress_2[STREET_SIZE];
    char city[CITY_SIZE];
    char state[STATE_CODE_SIZE];
    int zipCode;

//Public Class as Assingment required 
public:
    void setCustomerNumber(long cn);
    bool setName(char n[]);
    bool setStreetAddress1(char sa[]);
    bool setStreetAddress2(char sa[]);
    bool setCity(char c[]);
    bool setState(char s[]);
    bool setZipCode(int z);

    long getCustomerNumber();
    char* getName();
    char* getStreetAddress1();
    char* getStreetAddress2();
    char* getCity();
    char* getState();
    int getZipCode();
};

// setters
void Customer::setCustomerNumber(long cn)
{
    customerNumber = cn;
}

bool Customer::setName(char n[])
{
    //Confirmed NAME is not an empty string 
    //using Strcpy to copy one string to another
    if (strlen(n) > 0)
    {
        strcpy(name, n);
        return true;
    }

    return false;
}

bool Customer::setStreetAddress1(char sa[])
{
    // Confirmed StreetAddress1 is not an empty string
    if (strlen(sa) > 0)
    {
        strcpy(streetAddress_1, sa);
        return true;
    }

    return false;
}

bool Customer::setStreetAddress2(char sa[])
{
    // Confirmed StreetAddress2 is not an empty string
    if (strlen(sa) > 0)
    {
        strcpy(streetAddress_2, sa);
        return true;
    }

    return false;
}

bool Customer::setCity(char c[])
{
    // Confirmed city is not an empty string
    if (strlen(c) > 0)
    {
        strcpy(city, c);
        //all characters of city are letters
        for (int i = 0; i < strlen(city); i++)
        {
            city[i] = toupper(city[i]);
            if (city[i] < 'A' || city[i] > 'Z')
                return false;
        }

        return true;
    }

    return false;

}

bool Customer::setState(char s[])
{
    // Confirmed state is not an empty string
    if (strlen(s) > 0)
    {
        strcpy(state, s);
        // Confirmed all characters of state are letters
        for (int i = 0; i < strlen(state); i++)
        {
            state[i] = toupper(state[i]);
            if (state[i] < 'A' || state[i] > 'Z')
                return false;
        }

        return true;
    }

    return false;
}

bool Customer::setZipCode(int z)
{
    // Confirmed zipCode is between [0,99999]
    if (z >= 0 && z <= 99999)
    {
        zipCode = z;
        return true;
    }

    return false;
}

//Printing all the outputs 
long Customer::getCustomerNumber()
{
    return customerNumber;
}
char* Customer::getName()
{
    return name;
}
char* Customer::getStreetAddress1()
{
    return streetAddress_1;
}
char* Customer::getStreetAddress2()
{
    return streetAddress_2;
}
char* Customer::getCity()
{
    return city;
}
char* Customer::getState()
{
    return state;
}
int Customer::getZipCode()
{
    return zipCode;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Software Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education