Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a text file UserPassword.txt with the following two lines: Alice P4ssword Write a program to complete the following tasks: 1.Upon execution, the program will

Create a text file UserPassword.txt with the following two lines:

Alice

P4ssword

Write a program to complete the following tasks:

1.Upon execution, the program will prompt the user to type in his/her name.

2.The program will compare with the typed in name with the name stored in UserPassword.txt (the first line of the file).

3.If the name does not match, the program will prompt user to reenter the name; if the name match, the program will proceed to ask for the password.

4.Give the user 3 times to enter password, and compare the typed in value with the password stored in UserPassword.txt (the second line of the file). If the password is correct, display a greeting message and terminate the program; otherwise, display an error message and terminate the program.

Following is an sample screen of the program in execution:

Welcome! Please enter User Name: Bob

User Name does not exist!

Welcome! Please enter User Name: Alice

Welcome back, Alice!

Please enter User Password: 123

Password for Alice entered incorrectly!

Please enter User Password: P4ssword

Congratulations! You have successfully logged in. (Or: You have entered incorrect password for 3 times, system is shutting down)

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_2

Step: 3

blur-text-image_3

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

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

4. Explain the strengths and weaknesses of each approach.

Answered: 1 week ago