Implement program 4.