Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Have to use Java program For this program, you will need to prompt the user to i

ID: 3845034 • Letter: H

Question

Have to use Java program

For this program, you will need to prompt the user to input his/her first name, last name, birth month, birth day and birth year. Then you will display this information in two lines with the appropriate labels. Example Input: Please enter your first name: Joe Please enter your last name Schmoe Please enter your birth month 12 Please enter your birth day: 1 Please enter your birth year: 90 (this is the line of output from the program) (this is what the user will enter) Example Output: Name: Sehmoe, Joe Birthday: 12/1/90 Internal documentation includes: a. Name b. Date c. Class d. Program Purpose - what does this program do e. Single line documentation of any unique line(s) of programming

Explanation / Answer

Using BufferedReader for input

import java.io.*;
class User_Detail
{
public static void main(String args[])throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println( "Please enter your first name" );
String fName = br.readLine(); // to store first name
System.out.println( "Please enter your last name" );
String lName = br.readLine(); // to store last name
System.out.println( "Please enter your birth month: (in number format) " );
int birthM = Integer.parseInt(br.readLine()); // to store birth month
System.out.println( "Please enter your birth day: (in number format) " );
int birthD = Integer.parseInt(br.readLine()); // to store birth day
System.out.println( "Please enter your birth year:" );
int birthY = Integer.parseInt(br.readLine()); // to store birth year
System.out.println(" Name: " + lName + " ," + fName);
System.out.println(" Birthday : " + birthM + "/" + birthD + "/"+ birthY);
}
} // end

Using ScannerClass for input

import java.util.Scanner;
class User_Detail1
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);

System.out.println( "Please enter your first name" );
String fName = sc.nextLine(); // to store first name
System.out.println( "Please enter your last name" );
String lName = sc.nextLine(); // to store last name
System.out.println( "Please enter your birth month: (in number format) " );
int birthM = sc.nextInt(); // to store birth month
System.out.println( "Please enter your birth day: (in number format) " );
int birthD = sc.nextInt(); // to store birth day
System.out.println( "Please enter your birth year:" );
int birthY = sc.nextInt();// to store birth year
System.out.println(" Name: " + lName + " ," + fName);
System.out.println(" Birthday : " + birthM + "/" + birthD + "/"+ birthY);
}
} //end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote