I have written a bit of R code that helps you answer the last problem of the second homework assignment. y is the vector of population values. n is the sample size. R is the number of samples we will take.
For each sample we will calculate the sample mean and find its absolute error as an estimate of the population mean. We will also find the usual 95% confidence interval, its length and how often it contains the true population mean.