You're more likely to get a faster, more useful response if you ask about a specific part of your assignment, and not just a general "help".
Some things, in no particular order:
- You do not define a default contructor, so the compiler generates one for you (which does not initialize anything). You're supposed call your mutator ("set") functions from within your constructor.
- Notice that you have 'y' as a parameter to your "setYearsOfService" function, but you never use it. Instead, you hardcode it to always set yearsofservice as '10'. Same issue with 'setSalary'.
- Capitalization matters in C++. yearsOfService is not the same as yearsofservice.
- A char is not a string. A char is a single letter. Use a string instead.
1 2 3 4 5 6 7
|
#include <string>
// ...
class Employee {
...
std::string name;
...
};
|
- The "::" (scope resolution) operator needs to be "::", not ": :" (no spaces).
As you write code, you should be attempting to compile/build it often. This will help you catch syntax or semantic errors early on, and not overwhelm you later on.