Create a new C++ empty project titled \"CS115_IP3_YourName\" in the IDE. Design
ID: 3782657 • Letter: C
Question
Create a new C++ empty project titled "CS115_IP3_YourName" in the IDE. Design the customer class. Include at least the customer name and address for the class. Create class functions to set the class variables. Create class functions to get the values of the class variables. Create additional functions as necessary. Complete the following in your code: Implement the new class Create an object from the new class Set the customer details using the class functions Use the class functions to access the customer details. I'm using dev C and the lanuagage is english
Explanation / Answer
#include <iostream>
using namespace std;
class Customer
{
private:
string customer_name;
string address;
public:
Customer() //default constructor
{
this->customer_name = " ";
this->address = " ";
}
Customer(string customer_name,string address) //parameterized constructor
{
this->customer_name = customer_name;
this->address = address;
}
string getCustomerName() //get functions
{
return customer_name;
}
string getAddress()
{
return address;
}
void setAddress(string address) //set functions
{
this->address = address;
}
void setCustomerName(string customer_name)
{
this->customer_name = customer_name;
}
};
int main()
{
Customer c("Tim Jones","1045, Hillside, New Jersey");
cout<<"Name of the customer : "<<c.getCustomerName();
cout<<" address : "<<c.getAddress();
return 0;
}
output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.