1. Home
  2. Animals
  3. Help With Java Program?

Help With Java Program?

By Nature Smell Posted in: Animals

why does this program skip the input for a city name and pllz resond with the fixed answer
import java.util.Scanner;
public class story {
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
System.out.println(“Answer the following questions for a Madlibs Story.”);
System.out.println(“A name?”);
String name=keyboard.nextLine();
System.out.println(“An age?”);
int age=keyboard.nextInt();
System.out.println(“Name of a city?”);
String city=keyboard.nextLine();
System.out.println(“Name of a college?”);
String college=keyboard.nextLine();
System.out.println(“Name of a profession?”);
String prof=keyboard.nextLine();
System.out.println(“Type of animal?”);
String animal=keyboard.nextLine();
System.out.println(“Name of a pet?”);
String petname=keyboard.nextLine();
System.out.println(” There once was a person named ” + name + ” who lived in ” + city + “. At the age”);
System.out.println(“of ” + age + “, ” + name + ” went to college at ” + college + “. ” + name + ” graduated and went to”);
System.out.println(“work as a ” + prof + “. Then, ” + name + ” adopted a(n) ” + animal + ” named”);
System.out.println(petname + “. They both lived happily ever after!”);
}
}

Get Chitika Premium

Leave a Reply

You must be logged in to post a comment.

More Interesting Things

©2011 Nature Smell, All rights reserved.