javac SockMatching.java
java SockMatching
There is a heap of new labelled socks. Each sock is having one of four colours: white, black, blue and grey. There are several robotic arms which can pick up a single sock at a time and pass it to a matching machine. The matching machine is able to find two socks of the same colour and pass the pair of socks to a shelf manager robot. The shelf manager robot then puts the pair of socks to the appropriate shelf.
Write a java program to simulate the sock sorting system.