added code and plot for six questions