X449: Encapsulated Class Design

Design a class Dog, making sure it is appropriately encapsulated. The class will have the properties 'name' and 'breed' (both Strings), a constructor, and getters/setters for both fields (called getName, et cetera). Use the constructor and setters to validate input for both properties so that they always have the first letter capital and no others. If the input is invalid, change it into valid format before proceeding. TESTS NEED FIXING

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.