Advertisement
Guest User

ass

a guest
Jul 17th, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public class TheNameGame {
  2.     public static void main(String args[]){
  3.         Scanner kybd = new Scanner(System.in);
  4.         String name = kybd.nextLine();
  5. int space = name.indexOf(' ');
  6. int length = name.length();
  7. String firstname = name.substring(0, space);
  8. String lastname = name.substring(space+1, length);
  9. System.out.println("What is your name? " + firstname + " " + lastname);
  10.         all(firstname, lastname);
  11.     }
  12.     public static void all(String first, String last){
  13.         chant(first);
  14.         chant(last);
  15.     }
  16.     public static void chant(String first){
  17.         String nofirstletter = first.substring(1);
  18.         System.out.println(first + " " + first + ", bo-B" + nofirstletter);
  19.         System.out.println("Banana-fana fo-F" + nofirstletter);
  20.         System.out.println("Fee-fi-mo-M" + nofirstletter);
  21.         String allcaps = first.toUpperCase();
  22.         System.out.println(allcaps + "!");
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement