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
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