Question: Write a class Motor, which might be potentially used to encapsulate access to a physical motor. Create a header file declaring the class. Implement member
Write a class Motor, which might be potentially used to encapsulate access to a physical motor. Create a header file declaring
the class.
Implement member variables and functions that would cover motor's behaviour in the following scope: Each motor is
initially off and can be switched on and off. The speed can be increased from to in steps of one.
Advanced Option The code will verify that the speed can only be increased in steps of or levels.
Advanced Option The code will verify that the motor is on when the speed gets changed and the speed is zero when the
motor gets switched off.
In another file: Create an array with motor objects. Switch on all motors. Write a function that will determine the average
motor speed and adjust all motors in the array as close to the average value as possible.
Advanced Option Overload the operators and to compare the motor speed between two motor objects.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
