I'm trying to create a program where it takes the first character of the Last name and place the person in a group due to the name.
I tried comparing the words to numbers i.e. a=1, s=19, etc.
any help at all would be appreciated
package GroupAssignment;
import System.*;
/**
* Bushra Osman
*/
public class Program
{
public static void main(String[] args)
{
int group;
String fn, ln;
Console.Write("Enter your first name: ");
fn = Console.ReadLine();
Console.Write("Enter your last name: ");
ln = Console.ReadLine();
Console.Write(fn+" "+ln);
Console.Write(" is part of group ");
if ((ln > 0) && (ln <= 9))
{
group = 1;
Console.Write(group);
}
else if ((ln >= 10) && (ln <= 19))
{
group = 2;
Console.Write(group);
}
else if ((ln >= 20) && (ln <= 26))
{
group = 3;
Console.Write(group);
}
Console.ReadLine();
}
}