Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created Nov 10, 2020
Embed
What would you like to do?
Codecademy export
public class MadLibs {
/*
This program generates a mad libbed story.
Author: Laura
Date: 2/19/2049
*/
public static void main(String[] args){
String name1 = "she";
String adjective1 = "happy";
String adjective2 = "beautiful";
String adjective3 = "charming";
String verb1 = "listening";
String noun1 = "boy";
String noun2 = "stuff";
String noun3 = "right";
String noun4 = "luck";
String noun5 = "moment";
String noun6 = "discomfort";
String name2 = "him";
int number = 5;
String place1 = "glasgow";
//The template for the story
String story = "This morning "+name1+" woke up feeling "+adjective1+". 'It is going to be a "+adjective2+" day!' Outside, a bunch of "+noun1+"s were protesting to keep "+noun2+" in stores. They began to "+verb1+" to the rhythm of the "+noun3+", which made all the "+noun4+"s very "+adjective3+". Concerned, "+name1+" texted "+name2+", who flew "+name1+" to "+place1+" and dropped "+name1+" in a puddle of frozen "+noun5+". "+name1+" woke up in the year "+number+", in a world where "+noun6+"s ruled the world.";
System.out.println(story);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment