Firstly, I doubt there's anybody here on the forum willing to write code for you - but will offer their advice and expertise to help you help yourself to write code, by providing help with specific problems.
So, take a look at the following Arduino page on Ping))) setups. You can pick out simple bits you need - in your code, you wish to output to serial, so you must initialize serial comms using the Serial.begin function.http://arduino.cc/en/Tutorial/Ping?from=Tutorial.UltrasoundSensor
For things like counting time, check the Arduino example for the 'Blink without delay' example, in there is a snippet of code which counts time.... Please ask specific questions on here, not the classic "I haven't done my homework, please do it for me"