did part c and added the java code
fixed merges