⭐ Let's code a MAD LIBS game with Java!

82 Views
Published
#java #javatutorial #javacourse

import java.util.Scanner;

public class Main {
public static void main(String[] args) {

// MAD LIBS GAME

Scanner scanner = new Scanner(System.in);

String adjective1;
String noun1;
String adjective2;
String verb1;
String adjective3;

System.out.print("Enter an adjective (description): ");
adjective1 = scanner.nextLine();
System.out.print("Enter a noun (animal or person): ");
noun1 = scanner.nextLine();
System.out.print("Enter an adjective (description): ");
adjective2 = scanner.nextLine();
System.out.print("Enter a verb ending with -ing (action): ");
verb1 = scanner.nextLine();
System.out.print("Enter an adjective (description): ");
adjective3 = scanner.nextLine();

System.out.println("\nToday I went to a " + adjective1 + " zoo.");
System.out.println("In an exhibit, I saw a " + noun1 + ".");
System.out.println(noun1 + " was " + adjective2 + " and " + verb1 + "!");
System.out.println("I was " + adjective3 + "!");

scanner.close();
}
}
Category
Bro Code
Tags
java tutorial, java course, java programming
Be the first to comment