I don't know what to do with this
This is the code that I have, I am not sure if the codes are correct, first one is the file that suppose to ask about person's name, and count the number of characters in the name. and calculate if the person's age is odd or even. lastly, it should convert user input into ASCII code
can anyone proof read this code for me, thanks.
second file is combination lock with three numbers and gives maximum of 3 tries.
class readString
//define class
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//defines the input format
{
String name; //Name
int age; // a user-entered number
System.out.println("Enter your name ");
input = stdin.readLine();
name = input;
System.out.println ("Thanks for providing your name" + name) ;
int length = name.length();
System.out.println ("Your name has" + length "characters")
//makes user input his/her name, and gives the length of the name
System.out.println("Enter your age ");
input = stdin.readLine();
int age =input;
int age = (int)numbers;
if ( age % 2 == 0)
System.out.println ("Your age is even")
else
System.out.println ("your age is odd")
//makes user enter age and calculate if it is even or odd
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
{
System.out.println("Enter anything ");
input = stdin.readLine();
int ascii = str.charAt(input);
System.out.println ("ASCII Code of your input:" + ascii)
//outputs what user inputted into ASCII code
}
}
and other one
class ComboLockWhile
public static void main (String[] args )
{
int count = 1;
while ( count <= 3 ) // loop while count is <= 3
{
System.out.println( "count is:" + count );
count = count + 1; // add one to count
}
System.out.println( "Lock doesn't open" );
}
}
// The combination
int lockFirst = 6, lockSecond = 12, lockThird = 30;
int numb; // a user-entered number
BufferedReader stdin = new BufferedReader(
new InputStreamReader( System.in ) );
String input;
boolean correct = true;
//First Number
System.out.println("Enter first number: ");
input = stdin.readLine();
numb = Integer.parseInt( input );
if (lockfirst = numb)
correct = System.out.println (揊irst Number Right:? ;
//Second Number
System.out.println("Enter second number: ");
input = stdin.readLine();
numb = Integer.parseInt( input );
if (locksecond = numb)
correct = System.out.println (揝econd Number Right? ;
//Third Number
System.out.println("Enter third number: ");
input = stdin.readLine();
numb = Integer.parseInt( input );
if (lockthird= numb)
correct = System.out.println (揟hird Number Right:? ;
//Result
if ( correct )
System.out.println("Lock opens");
else
System.out.println("Lock does not open");
}
}

