You are on page 1of 1

---- ŞİFRE YAPISI

import java.util.Scanner;

public class LogIn {


public static void Log(int i){
Scanner enter= new Scanner(System.in);
String Pw = "";

int asciiPwCounter,nopwctr;

for ( i = 48; i <= 122;i++) {


System.out.print((char)i);
if (i==60 || i==72 || i==84 || i==96 || i==108 || i==122)System.out.println(" ");
}

do{
asciiPwCounter=0;
nopwctr=0;
System.out.println("Yukarıdaki Sanal Klavyeye Göre ve");
System.out.println("8 haneli en az iki hanesi Harf olcak şekilde");
System.out.print("Lütfen Şifre giriniz: ");
Pw=enter.next();

if (Pw.length()!=8){
System.out.println("--|->Şifre Hatalı tekrar giriniz");

}
for ( i = 0; i <Pw.length() ; i++) {
if((int) Pw.charAt(i)<48 || (int) Pw.charAt(i)>122) nopwctr++;
}
if(nopwctr!=0) System.out.println("--|->Şifre Hatalı tekrar giriniz");

for ( i = 0; i < Pw.length(); i++) {


if( ((int) Pw.charAt(i)>=65 && (int) Pw.charAt(i)<=90) || ((int) Pw.charAt(i)>=97 && (int)
Pw.charAt(i)<=127)){
asciiPwCounter++;
}
}
if(asciiPwCounter<2) System.out.println("--|->Şifre Hatalı tekrar giriniz");

}
while (Pw.length()!=8 || nopwctr!=0 || asciiPwCounter<2 );

for (int j = 7; j >= 0 ; j--) {


System.out.print(""+Pw.charAt(j));
}
System.out.println();
System.out.println("no PW : "+nopwctr);
System.out.println("Sayaç : "+asciiPwCounter);
System.out.println("Şifren : "+Pw);
}
}

You might also like