Moving a car game in java
I need some help about hw i need to do a car game its so basic but i cant reach what i need to do the description about hw is like that
We would like to write a program about cars that can move along a single dimensional axis (E.g. x axis). Your job is to design, implement and test a car class which has the following properties:
Brand, Model, ModelYear, color, engineSize, fuelTankVolume, positionX, direction.
The car class should have the following basic behaviors
Getters/setters (Accessors, mutators): declare all fields private and write getter/setter methods for each.
moveforward: Cars can only move if they have enough fuel. For each step (movement) cars consume their fuel accordingly to the following formula engineSize/1000*4. Move the car in the moveSpeed*MaxWeight/Weight. positionX must be updated accordingly.
changeDirection: reverses the direction faced.
print: prints all the datafields and especially current fuel left, positionX and direction.
• The car class must have shared (static) datafields moveSpeed, maxWeight, numberOfCars, maxWeight.
• Assume maximum car weight can be a constant value, e.g. 2000kg.
• Assume moveSpeed is non-constant value, e.g. 5.
• The class should have a no-argument constructor which assigns meaningful initial values.
• The class must have an argument constructor which assigns given brand, model, modelYear, colour, engineSize, fuelTankVolume, positionX, direction.
• The class also should be aware of how many cars (instances) are created during the program. Use numberOfCars in constructors to achieve this.
a) Draw the UML diagram of the cars class
b) Implement the class.
c) Write a tester class which invokes carSim1 method which creates a car prints the car, moves it, changes direction, and moves again few times, and prints again.
d) Write another method carSim2 method which creates 10 cars (use an array), invokes print for each of them. Then makes them move, change direction RANDOMLY and print again to see the fuel volume.
Its a bit long but i need to do this if someone help me about this i will be pleased.