Question: Write a class Car that contains the following attributes: 1 The name of car. 2 The direction of car (E, W, N, S) 3 The
Write a class Car that contains the following attributes:
1 The name of car.
2 The direction of car (E, W, N, S)
3 The position of car (from imaginary zero point)
The class has the followin member function:
1 A constructor to intiallize the attributes
2 Turn function to change the direction of car to one step right side (e.g if the direction is E it should be changet to S and so on.)
3 Overload the Turn function to change to any side directly. It should accept the direction as parameter.
4 Move function to change the position of car away from zero point.It should accept the distance as parameter.
Write complete c++ program
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
