I do not know the meaning of "JVS" ?
It is possible to create class to do what you want.
The question is you need to structure your design into model and rules.
You might want to learn to program it with EJS.
You are also welcomed to check out all the simulations at this web site.