sample code written to answer questions