User Class ATTRIBUTES NOTE: The important method has been given to you. userld:int //generates unique id from 10001 upwards username:string firstname:string lastname:string dob:string INSTRUCTION 1 The program should generate unique userld whenever new object is created. Notice that idGenerator is static variable, so assign the current value of idGenerator age: int idGenerator: static int; totalUsers : static int to userld, so that each user will have unique user id (Starting from 10001). Then increment idGenerator by 1. INSTRUCTION 2 МЕТНODS User() User(string, string, string, int) User(const User&) "User() The totalUsers is also a static variable. This should keep track of the total users in the class. With the Above UML for CLASS USER, answer the following questions 1. Complete or Create the default constructor method. a. The default constructor should accept just the firstname, lastname, dob (date of birth) and age from the keyboard. b. Write a setter method that sets the username to a user. ( use void setUsername( ?)). 2. Create one user object that invokes the default constructor. 3. Set the username for the newly created object to "user+userld"(user10001). 4. Create the following getter methods a. Getter method for firstname ( use ? getFirstname( ) ). b. Getter method for lastname ( use ? getlastname( ) ). c. Getter method for userld ( use ? getUserld( ) ). d. Getter method for totalUsers ( use ? getTotalUsers( ) ). 5. Create one array object to hold information for 3 users. The array object should invoke the parameterized constructor. (Use Random Data). a. For each array location created, assign a username to it.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
100%
User Class
NOTE: The important method has been
ATTRIBUTES
given to you.
userld:int //generates unique id from 10001
upwards
INSTRUCTION 1
username:string
firstname:string
lastname:string
dob:string
The program should generate unique
userld whenever new object is created.
Notice that idGenerator is static variable,
so assign the current value of idGenerator
age: int
idGenerator: static int;
to userld, so that each user will have
totalUsers : static int
МЕТНODS
User()
User(string, string, string, int)
User(const User&)
"User()
unique user id (Starting from 10001).
Then increment idGenerator by 1.
INSTRUCTION 2
The totalUsers is also a static variable.
This should keep track of the total users in
the class.
With the Above UML for CLASS USER, answer the following questions
1. Complete or Create the default constructor method.
a. The default constructor should accept just the firstname, lastname, dob (date of
birth) and age from the keyboard.
b. Write a setter method that sets the username to a user.
( use void setUsername( ?)).
2. Create one user object that invokes the default constructor.
3. Set the username for the newly created object to "user+userld"(user10001).
4. Create the following getter methods
a. Getter method for firstname ( use ? getFirstname( ) ).
b. Getter method for lastname ( use ? getlastname( ) ).
c. Getter method for userld ( use ? getUserld( ) ).
d. Getter method for totalUsers ( use ? getTotalUsers( ) ).
5. Create one array object to hold information for 3 users. The array object should invoke
the parameterized constructor. (Use Random Data).
a. For each array location created, assign a username to it.
Transcribed Image Text:User Class NOTE: The important method has been ATTRIBUTES given to you. userld:int //generates unique id from 10001 upwards INSTRUCTION 1 username:string firstname:string lastname:string dob:string The program should generate unique userld whenever new object is created. Notice that idGenerator is static variable, so assign the current value of idGenerator age: int idGenerator: static int; to userld, so that each user will have totalUsers : static int МЕТНODS User() User(string, string, string, int) User(const User&) "User() unique user id (Starting from 10001). Then increment idGenerator by 1. INSTRUCTION 2 The totalUsers is also a static variable. This should keep track of the total users in the class. With the Above UML for CLASS USER, answer the following questions 1. Complete or Create the default constructor method. a. The default constructor should accept just the firstname, lastname, dob (date of birth) and age from the keyboard. b. Write a setter method that sets the username to a user. ( use void setUsername( ?)). 2. Create one user object that invokes the default constructor. 3. Set the username for the newly created object to "user+userld"(user10001). 4. Create the following getter methods a. Getter method for firstname ( use ? getFirstname( ) ). b. Getter method for lastname ( use ? getlastname( ) ). c. Getter method for userld ( use ? getUserld( ) ). d. Getter method for totalUsers ( use ? getTotalUsers( ) ). 5. Create one array object to hold information for 3 users. The array object should invoke the parameterized constructor. (Use Random Data). a. For each array location created, assign a username to it.
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT