Question
Write this code in Java. Implement the following Userclass: State Three string variables for username, password, and a password hint Behavior A constructor that accepts
Write this code in Java.
Implement the following Userclass:
State
Three string variables for username, password, and a password hint
Behavior
A constructor that accepts three string arguments that are used to initialize the above three instance variables (in the above order)
getUsername and getHint methods (you shold not have a getPassword method).
a verifyPassword method that accepts a string and returns true/false depending on whether the parameter matches the User's password
a toString method that returns User username.
the usual read method (i.e., accepts a Scanner, reads in the username, password, and hint from a file and uses them to create and return a new User object).
The name of your class should be DataChecker.
Your class is tested by a UserApp class that reads in Users from a file using your read method, print out the User using your toString, and makes sure the password is not the same as the username by calling verifyPassword passing it the username.
For example, if the file users.data contains:
weiss puppy2 woof-woof arnow java cuppa tenenbaum tenenbaum da-same sokol brooklyn college
Here are sample executions of the program:. User input is in bold. Your program should replicate the prompts and output:
username? arnow password? java Welcome to the system
username? weiss password? dontremember *** Invalid password - hint: woof-woof username? weiss password? puppy2 Welcome to the system
username? sokol password? CUNY *** Invalid password - hint: college username? sokol password? SUNY *** Invalid password - hint: college username? sokol password? BC *** Invalid password - hint: college Too many failed attempts... please try again later
Step 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