Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

=+2. Is this public actively seeking information on this issue?

Answered: 1 week ago

Question

Why does sin 2x + cos2x =1 ?

Answered: 1 week ago

Question

What are DNA and RNA and what is the difference between them?

Answered: 1 week ago

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago