Write a program in java Write a class Car that contains the followings attributes: The name of Car The direction of Car (E, W, N, and S) The position of Car (from imaginary zero point) The class has...


Write a program in java


Write a class Car that contains the followings attributes:



  1. The name of Car

  2. The direction of Car (E, W, N, and S)

  3. The position of Car (from imaginary zero point)

  4. The class has the following members



  • A constructor to initialize the instance variables

  • Turn function to change the direction of Car to one step right side (e.g. if the direction is to E, it should be changed to S and so on.

  • Overload the Turn function to change the direction to any side directly. It should accept the direction as parameter.

  • Move function to change the position of Car away from zero point. It should accept the distance as parameter.



Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here