Task 3 - Movement of cars (objects) - solution:
The project consists of two files, ie. two classes. A class that describes a car should have defined attributes that pertain to the car and are relevant to this example. So velocity, distance displacement and time of an car. The constructor of that class is inserted into it, and method "toString() too".
Class Automobile is:
Class Automobile is:
In the main class, we create the objects, and then the input data acceleration and time for both cars are entered:
In the main class, we create the objects, and then the input data acceleration and time for both cars are entered:
After starting the application: