to complete the code of controldemo