OOPs-Challenge

Various Attributes used:

  1. make (string): The make of the car (e.g., Hyundai, Maruti, BMW)
  2. model (string): The model of the car (e.g., Alto, Creta, City)
  3. year (int): The year the car was made
  4. speedx (int): The current speed of the car in miles per hour in x direction
  5. speedy (int): The current speed of the car in miles per hour in y direction
  6. speedz (int): The current speed of the car in miles per hour in z direction
  7. x (int): The x-coordinate of the car
  8. y (int): The y-coordinate of the car
  9. z (int): The z-coordinate of the car

I have used various methods in class:

1. accelerate(speed_incrementx, speed_incrementy, speed_incrementz): This method should take an argument that represents the speed increment and increase the speed of the car by that amount.

2. brake(speed_decrementx, speed_decrementy, speed_decrementz): This method takespeed decrement and decrease the speed of the car by that amount.

3. move(time): This method should update the x and y coordinates of the car based on its current speed.

4. detect_collision(car2): This method takes an argument that represents another car and return True if the two cars have collided, and False otherwise.

5. time_to_collision(car2): This method takes an argument that represents another car and return the time it will take for the two cars to collide, assuming they continue to move at their current speeds. I have iterated over the time to check whether the collision takes place or not.