Question
In the FishermanLicense class, declare the following public member functions: SetYear() that takes one integer parameter SetNum() that takes one integer parameter SetId() that takes
In the FishermanLicense class, declare the following public member functions:
SetYear() that takes one integer parameter
SetNum() that takes one integer parameter
SetId() that takes one integer parameter
and the following private data members:
integer year
integer number
integer id
Ex: If the input is 1998 37 772, then the output is:
License year: 1998 License number: 37 License id: 772
#include
class FishermanLicense { public: int GetYear() const; int GetNum() const; int GetId() const; /* Member function declarations go here */ private: /* Data members go here */ };
void FishermanLicense::SetYear(int customYear) { year = customYear; }
void FishermanLicense::SetNum(int customNum) { number = customNum; }
void FishermanLicense::SetId(int customId) { id = customId; }
int FishermanLicense::GetYear() const { return year; }
int FishermanLicense::GetNum() const { return number; }
int FishermanLicense::GetId() const { return id; }
int main() { FishermanLicense fisherman1; int inputYear; int inputNum; int inputId;
cin >> inputYear; cin >> inputNum; cin >> inputId;
fisherman1.SetYear(inputYear); fisherman1.SetNum(inputNum); fisherman1.SetId(inputId); cout << "License year: " << fisherman1.GetYear() << endl; cout << "License number: " << fisherman1.GetNum() << endl; cout << "License id: " << fisherman1.GetId() << endl;
return 0; }
c++ asap and please plase make it correct
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started