menu
bartleby
search
close search
Hit Return to see all results

Design a program that prompts user enters user name and password. Until user entered user name as "FakeUser", prompts user enters password. Display "Welcome, FakeUser" and until user entered correct password "Secret@123".  The program should also display the number of times user tried to get the correct user name and password. Can anybody provide me step by step solution for this problem? Please solve the problem by using raptor.

Question

Design a program that prompts user enters user name and password. Until user entered user name as "FakeUser", prompts user enters password. Display "Welcome, FakeUser" and until user entered correct password "Secret@123".  The program should also display the number of times user tried to get the correct user name and password.

 

Can anybody provide me step by step solution for this problem? Please solve the problem by using raptor. 

check_circleAnswer
Step 1

Note: The given program is compiled and executed in "NetBeans IDE"

Step 2

Program:

//Import required package
import java.util.Scanner;

//Definition of class "Sample"
public class Sample
{
//Definition of main class
public static void main (String[] args)
{
//Declare the variables
String U_Name= "", pass_Word = "";

//Declare and initialize the count variable
int u_count=0, p_count = 0;

//Crate an object for scanner class
Scanner sc = new Scanner(System.in);
do
{
//Increment "ucount"
u_count++;

System.out.println("Please enter your name:");

//Prompt the name from the user
U_Name = sc.nextLine();

//Check whether the user "FakeUser"
if((U_Name.equals("FakeUser")))
{
//Use do..while loop
do
{
//Increment "pcount"
p_count++;

//Prompt the password from the user
System.out.println("Please enter you...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: How do you convert 172.16.20.55 to binary format?

A: 172.16.20.55 represents IP address in decimal format. In order to convert it into binary format we n...

question_answer

Q: AskForNumbers Declare an integer array locally with the size of 200. Create a program that asks the ...

A: In order to implement the question mentions a method called getChoice() information about which has ...

question_answer

Q: 2. Write a program called ListOddNumbers that prints the below (there is a single space between each...

A: Solution: 2. The below program is written in Java language to display the odd number between 1 and 5...

question_answer

Q: I was asked to add the three types of comments to this class, each consisting of the same statement ...

A: Java documentation comment: This comment is used to create documentation API. The syntax for this co...

question_answer

Q: I am trying to read in a text file called "lines.txt" that holds an entire dictionary of words with ...

A: First you need to use the ifstream class object to read from file.

question_answer

Q: Use the worksheets to show, one path augmentation at a time, how to use the Ford-Fulkerson Algorithm...

A: For solving your problem first of all we define Ford-Fulkerson Algorithm.Ford-Fulkerson Algorithm fo...

question_answer

Q: What is the most important thing to help with introduction to computers?

A: The most important thing in introduction to computers are,Hardware andSoftware

question_answer

Q: Write a complete C++ program that randomly generates 20 integers between the rangeof 1 to 50 and sto...

A: The random number is generated by using rand() function from stdlib.h and in order to generate a new...

question_answer

Q: The following print code is to find out the ASCII code, character for the decimal codes,and comparis...

A: The algorithm would involve converting the input integer to character using casting operator as show...

Sorry about that. What wasn’t helpful?