Answer:
#include <iostream>
using namespace std;
class DogLicense{
public:
void SetYear(int yearRegistered);
void CreateLicenseNum(int customID);
int GetLicenseNum() const;
private:
int licenseYear;
int licenseNum;
};
void DogLicense::SetYear(int yearRegistered) {
licenseYear = yearRegistered;
}
void DogLicense::CreateLicenseNum(int customID) {
licenseNum = (100000 * customID) + licenseYear;
}
int DogLicense::GetLicenseNum() const {
return licenseNum;
}
int main() {
DogLicense dog1;
dog1.SetYear(2014);
dog1.CreateLicenseNum(777);
cout << "Dog license: " << dog1.GetLicenseNum() << endl;
return 0;
}
Explanation:
You can see the whole code above, but let me explain the fixed function.
void DogLicense::CreateLicenseNum(int customID) {
licenseNum = (100000 * customID) + licenseYear;
}
The function header is already declared in the class. It takes <em>customID</em> as a parameter. To find out the <em>lisenseNum</em>, we need to apply the given formula <em><u>(100000 * customID) + licenseYear</u></em>.