Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TheNameGame {
- public static void main(String args[]){
- Scanner kybd = new Scanner(System.in);
- String name = kybd.nextLine();
- int space = name.indexOf(' ');
- int length = name.length();
- String firstname = name.substring(0, space);
- String lastname = name.substring(space+1, length);
- System.out.println("What is your name? " + firstname + " " + lastname);
- all(firstname, lastname);
- }
- public static void all(String first, String last){
- chant(first);
- chant(last);
- }
- public static void chant(String first){
- String nofirstletter = first.substring(1);
- System.out.println(first + " " + first + ", bo-B" + nofirstletter);
- System.out.println("Banana-fana fo-F" + nofirstletter);
- System.out.println("Fee-fi-mo-M" + nofirstletter);
- String allcaps = first.toUpperCase();
- System.out.println(allcaps + "!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement