Skip to content

Instantly share code, notes, and snippets.

@ah052070
Created November 2, 2012 01:13
Show Gist options
  • Save ah052070/3998027 to your computer and use it in GitHub Desktop.
Save ah052070/3998027 to your computer and use it in GitHub Desktop.
Simple string program in Java
Alexander Hunting
COP2258
A1b
import java.util.Scanner; //imports utility that takes in or holds the name of user insect
public class BabyBumbleBee{
public static void main(String[] args){
System.out.println ("What is the name of your insect?");
Scanner input = new Scanner(System.in);
String myInsect = input.nextLine();
for(int counter=0; counter <5; counter = counter + 1){
if(counter < 1){
String a = "bringing home ";
String b = "Ouch!!! It Stung me!!! ";
System.out.println( "I'm " + a + "my baby " + myInsect);
System.out.println("Won't my mommy be so proud of me");
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println(b);
}//end if
if(counter < 2){
String a = "squishin' up";
String b = "Ew!! What a mess!!";
System.out.println("I'm " + a + "my baby " + myInsect );
System.out.println("Won't my mommy be so proud of me");
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println(b);
}// end if
if(counter < 3){
String a = "licking up";
String b = "Ick!! I feel sick!! ";
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println("Won't my mommy be so proud of me");
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println(b);
}//end if
if(counter < 4){
String a = "barfin' up";
String b = "Oh!! What a mess!!";
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println("Won't my mommy be so proud of me");
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println(b);
}//end if
if(counter < 5){
String a = "wipin up";
String b = "Oops!! Mommy's new towel!!";
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println("Won't my mommy be so proud of me");
System.out.println("I'm " + a + "my baby " + myInsect);
System.out.println(b);
}// end if
if(counter == 5){
String a = "wringin out";
String b = "Bye Bye Baby";
System.out.println("I'm" + a + "my baby" + myInsect);
}//end if
}//end for
}//end main
}//end class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment