Question: In the Store class, complete the function definition for SetNumSold ( ) with the integer parameter customNumSold. Ex: If the input is 4 1 6

In the Store class, complete the function definition for SetNumSold() with the integer parameter customNumSold.
Ex: If the input is 4160, then the output is:
Years open: 41
Number of items sold: 60
#include
using namespace std;
class Store {
public:
void SetYearsOpen(int customYearsOpen);
void SetNumSold(int customNumSold);
int GetYearsOpen() const;
int GetNumSold() const;
private:
int yearsOpen;
int numSold;
};
void Store::SetYearsOpen(int customYearsOpen){
yearsOpen = customYearsOpen;
}
void Store::SetNumSold(int customNumSold){
{
numSold = customNumSold;
}
int Store::GetYearsOpen() const {
return yearsOpen;
}
int Store::GetNumSold() const {
return numSold;
}
int main(){
Store store1;
int inputYearsOpen;
int inputNumSold;
cin >> inputYearsOpen;
cin >> inputNumSold;
store1.SetYearsOpen(inputYearsOpen);
store1.SetNumSold(inputNumSold);
cout << "Years open: "<< store1.GetYearsOpen()<< endl;
cout << "Number of items sold: "<< store1.GetNumSold()<< endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!