In this problem we create two car objects that have different speed and coordinates we then call the methods such as accelerate,break, so their speed changes and updates their coordinates bsed on their current speed then the method detect collision is call to check if the cars will collide or not and calculate the time of collision after that we print the output in console