Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you please answer this question with great detail and with clear steps clearly showing what have you done, in java language please. i need
can you please answer this question with great detail and with clear steps clearly showing what have you done, in java language please. i need the code written for this question, i dont have the computertest.java
Question 2 (14 marks) a) Complete the following UML diagram as Java classes (8 mo write a constructor for ComputerUser class based on the information you have in the UML. Complete the hasSpaces method to check if a string has space or not. Extend ComputerUser class with two subclasses, as shown below in UML diagram and write the appropriate methods listed in the UML diagram. ii. > ComputerUser # username: String # password: String + ComputerUser(String, String) + getUsername(): String + setUsername(String) + getPassword(): String + setPassword(String) + hasSpaces(String): boolean + toString(): String Staff Student - fullname: String + Staff (String, String) + setUsername(String) - getFullName(): String - setFullName(String) - address: String + Student(String, String) + setUsername(String) +getAddress(): String + setAddress(String) b) According to the following class specifications, update the appropriate mutator (set) methods so that: i. All ComputerUsers must be set with a valid password with 16 numerical characters only (no letters, symbols or spaces). Otherwise, the password is left as the empty string (2 marks) ii. Staff must have a username of at least 8 characters, with no spaces. For example, employee 2019. Otherwise, the username is set to "defaultemployeeusername" (2 marks) A Student must have a username of at least 10 characters, with no spaces. Student usernames are automatically formatted and stored in uppercase. For example, STUDENTUSER. Otherwise, the username is set to "DEFAULTSTUDENT" (2 marks) Page 15 of 20 CUMPJULIULU Once you completed the code, uncomment the main method in ComputerUser Test class and run the code. Your output should be the same as the following: User 1: username: staff 01, password: User 2: username: defaultemployeeusername, password: 123456789410 User 3: username: defaultemployeeusername, password: User 4: username: defaultemployeeusername, password: 12345678910111213 User 5: username: staff52019, password: 12345678910111213 User 6: username: DEFAULTSTUDENT, password: 13121110987654321 User 7: username: DEFAULTSTUDENT, password: 13121110987654321 User 8: username: STUDENT 3@. password: 13121110987654321 User 9: username: STUDENTY@S2 2019. password: 13121110987654321Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started