** Must be in C++ please. Also must follow the requirements below exactly, pleas
ID: 672340 • Letter: #
Question
** Must be in C++ please. Also must follow the requirements below exactly, please do not use any further advanced techniques. (Shouldn't include anything beyond classes, functions, arrays, or loops such as for and while). Thank you! **
- Write a class definition for dog
- Private data fields for name, breed, and age
- Constant static field for the license fee (the fee is $12.25)
- Create a public member functions to set the display data
- Write a main() function that shows the class works correctly
Explanation / Answer
#include<iostream>
class dog
{
string name,breed;
int age;
static const float fee;
public:
void get_data(string a,string b, int c)
{
name=a;
breed=b;
age=c;
}
void set_data()
{
cout<<name<<" "<<breed<<" "<<age<<" "<<fee;
}
};
int main()
{
dog a= new dog();
a.get_data('Bruno',Pug',5);
a.set_data();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.