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.
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.
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 14RQ
Related questions
Question
100%
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps
Knowledge Booster
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.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT