Modified program with parameterized constructors for Exercise 7.1