To encode the car color -I am guessing car color can take only 3 values: red, blue, green.
You can encode it as follows:
In the above table, Green will become the reference level. In your situation, if your color takes 'n' values then you will need to include n-1 dummy variables.
You can get the implementation in Java in the Weka filter NominalToBinary, this will create n variables for n categories.