daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. System.out.println("Zadanie 7 - - Gender Validator");
  2.         System.out.println("Show me Your name : ");
  3.         Scanner scanner = new Scanner(System.in);
  4.         String name = scanner.next();
  5.         int howMany = name.length();
  6.         char lastChar = name.charAt(howMany-1);
  7.         System.out.println(lastChar);
  8.         char character = 'a';
  9.         List myList = new ArrayList();
  10.         myList.add("Miriam");
  11.         myList.add("Beatricze");
  12.         System.out.println(myList.size());
  13.         if (lastChar==character)
  14.         {
  15.             System.out.println("This name is Female!");
  16.         }
  17.         else
  18.         {
  19.             int count = 0;
  20.             while ( count < myList.size()-1 )
  21.             {
  22.                 if (name.equals(myList.indexOf(count)))
  23.                 {
  24.                     System.out.println("This name is Female!");
  25.                     break;
  26.                 }
  27.                 else
  28.                 {
  29.                     System.out.println("This name is Male!");
  30.                 }
  31.                 count++;
  32.             }
  33.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top