Final Answer:
Create a class named `Book` with private instance variables for the book's name, number of pages, and current page. Implement public non-static methods to access and mutate these variables. Include a default constructor setting the name to "No Name Yet," number of pages to 0, and current page to 0. Ensure the program validates and ignores invalid values for the number of pages and the current page. Develop a separate class named `BookDemo` with a main method creating a `Book` object. Provide options for the user to update the name, number of pages, and current page, with a loop to continue until the user chooses to exit.
Step-by-step explanation:
The `Book` class is designed to encapsulate the properties of a book and ensure data integrity through private instance variables and public methods for access and mutation. The default constructor sets initial values and prevents invalid inputs. The `BookDemo` class, with its main method, serves as the program interface. It creates an instance of the `Book` class and allows the user to interact with the book's information. The program runs in a loop until the user chooses to exit, handling invalid options with error messages.
The use of object-oriented principles enhances modularity, encapsulation, and reusability. The `Book` class encapsulates the book's properties, ensuring controlled access through methods. The `BookDemo` class orchestrates user interactions, promoting a clean and organized design. This structure facilitates code maintenance and readability, making it easy to expand or modify the program in the future. The loop ensures the program's continuous execution until the user decides to exit, providing a user-friendly experience.