How to Create a Java Program for Generating Custom Passwords?

In summary: } } //end if //end for //end while //end if //end while
  • #36
mafagafo said:
Are you up to try the two methods I suggested earlier? When do you want to use the int? When it is lower OR upper, right? Implement it that way.
I can't use the two methods that you suggest earlier because, it would be "advanced" in my class now. However, my teacher said that she likes what she seeing? But, even she is giving me enough help :/
 
Physics news on Phys.org
  • #37
Think about the truth table again. Mark set up something really good but you did not honor his efforts. If you do not understand how to fill the TT, look on Wikipedia how to do it.

Let's use 0 for false and 1 for true?

[tex]\begin{array}{| c | c | c | c | c |} \hline
& ! \ge 65 & \le 90 & \ge 97 & \le 122 \\
66 &0& & & \\
93 &0& & & \\
101 &0& & & \\
123 &0& & & \\
\hline
\end{array}[/tex]

Now fill the rest!
 
Last edited:
  • #38
@Cia,
Here are the four comparisons again:
Code:
!(randNum>=65) && (randNum<=90) || (randNum>=97) && (randNum<=122)

In the table you filled out in post #32, you have F, F, F, and F in the first row when randNum is 66. The first, third, and fourth values are correct for the code you have (shown again up above), but the second one is wrong -- randNum IS less than or equal to 90. When we say that a certain number x is between, say 5 and 10, it has to be true that x ≥ 5 AND x ≤ 10. Both of these have to be true if x is somewhere between the two endpoints.

In contrast, if x is 20, we have x ≥ 5 again, but x > 10, so this x is not between 5 and 10.

In the second row of your table in post #32, you have two mistakes. If randNum is 93, the values you have for the four comparisons are T, T, T, and T.
For the first and second comparisons, the correct values are F and F.
 

Similar threads

Replies
12
Views
2K
Replies
7
Views
2K
Replies
1
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
12
Views
3K
Replies
1
Views
3K
Replies
4
Views
2K
Back
Top