Define two enum, first for Gender and another for Month. Gender shall be enumeration of two values i.e. Male and Female. Month enum shall be defined with January, February, ... up to December as values. Month enum shall also store the number of days of each month. Define a User that shall be composed of id, name, gender and birthMonth attributes. Use above created enums for gender and birthMonth fields. Create a User object and initialize it from user input, gender shall be initialized in constructor and birthMonth shall be initialzed using set methed. After the object is initialized, print all fields' values of user object. Also print the number of days of birthMonth.
Define two enum, first for Gender and another for Month. Gender shall be enumeration of two values i.e. Male and Female. Month enum shall be defined with January, February, ... up to December as values. Month enum shall also store the number of days of each month.
Define a User that shall be composed of id, name, gender and birthMonth attributes. Use above created enums for gender and birthMonth fields. Create a User object and initialize it from user input, gender shall be initialized in constructor and birthMonth shall be initialzed using set methed. After the object is initialized, print all fields' values of user object. Also print the number of days of birthMonth.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images