Java get user details
- by LC
I'm new to Java and I have to write a program to get user details which appear like this:
Author’s Details
****************
Name: J. Beans
YOB: 1969
Age: 41
Book Details
************
Title: *Wonderful Java*
ISBN: *978 0 470 10554 9*
Publisher: *Wiley*
This is what I've done but it does not work, can anyone help me to find out the problem ?
import java.util.Scanner ;
public class UserDetails
{
public static void main(String args[])
{
System scan = new Scanner(System.in);
input sname, fname, born, title, isbn, publisher;
System.out.print("Please enter author's surname:");
sname = input.nextLine();
System.out.print("Please the initial of author's first name:");
fname = input.nextLine();
System.out.print("Please enter the year the author was born:");
born = input.nextLine();
System.out.print("Please enter the author's book title:");
title = input.nextLine();
System.out.print("Please enter the book's ISBN:");
isbn = input.nextLine();
System.out.print("Please enter the publisher of the book:");
publisher = input.nextLine;
System.out.println("Author's detail");
System.out.println("**********************");
System.out.println("Name:" + fname + sname);
System.out.println("YOB:" + born);
System.out.println("Age" + born);
System.out.println("Book Details");
System.out.println("**********************");
System.out.println("Title:" + "*" + title + "*");
System.out.println("ISBN:" + "*" + isbn + "*");
System.out.println("Publisher:" + "*" + publisher + "*");
}
}