5/5 – (2 votes)
Learning Outcomes1.1. Implement classes – constructors, properties1.2. Do validation within accessors1.3. Utilize arrays of objects1.4. Call instance methods and properties
The New Library is commissioning a prototype of an application to keep track of inbound books for their internal system. Their external front-facing system keeps track of their catalog and provides extensive functionality. However, this new internal system is basic and is needed only to keep track of the books waiting to be entered into their full-fledged catalog.
For this internal system, the New Library would like to keep track of the title of books as well as the book year. These titles and years will be entered manually by users of the system. The New Library also has a standard practice that dates back more than a hundred years: books having inaccurate or no publication year listed use the year 1900, which was the first year at thelast turn of the century.
The New Library System should be basic: on its startup, the system should ask the user how many books need to be entered into the system. It should then ask for the book title and publication year. After the specified number of books have been entered into the system, it should let the user know entries is complete. The system should finally show a neatly organized list of the new books and their publication years.The New Library does not want any error messages to be shown. However, if the book publication year is not valid, which is to say that it doesn’t fall between the years of 1100 (roughly when the Oxford University was founded) and the current year of 2017, it wants the year to automatically default to 1900.
Set accessor modifies bad values3