Finished code for lab02 part 2