joshua go
joshua go

Reputation: 11

Java Program using Loops and Jump Statement

I need to create a program that will ask a password three times. But at the third time, having incorrect password, it will just ask for your name. We are asked to use loops on this and jump statements. Please help. ;)

Upvotes: 1

Views: 836

Answers (1)

0xAX
0xAX

Reputation: 21817

It's general algoritm,

for (int i = 0; i < 3; i++)
{
   if (i == 2 and password != true_password)
      ask_name();
}

But for more you can give your code.

p.s. declare i in the loop, thank you @glowcoder for remark.

Upvotes: 2

Related Questions