Question
Payroll System A company wants their payroll system developed in OOP and they have approached you for the basic structure and functionality. They want an
Payroll System A company wants their payroll system developed in OOP and they have approached you for the basic structure and functionality. They want an object with name and salary properties. The object should have a default constructor that initialises the properties to null and a parameterised constructor. The object should also have two accessors (methods of accessing the contents of a property), one for each property. They also want a method that will compare two objects and tell which has a better salary than the other. Source: Mlotshwa, M. (2021 )
Question 4
Using C++ programming Declare and implement an Employee class for the payroll system:
4.1 Declare a class that meets the scenario requirements. Ensure that the method that compares the two objects receives objects of the Employee class and returns an int.
4.2 Implement the class methods on the same code as the class declaration.
4.3 Write a main function in the same code and test the payroll system. Use the parameterised constructor to create the two objects and then test the method that compares the two and display a message that states which employee earns more than which employee.
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