Please insert appropriate screenshots and copy the complete code to this documen
ID: 3872447 • Letter: P
Question
Please insert appropriate screenshots and copy the complete code to this document and drop the document (1 document only) in the drop box titled LabAssgn#2. Do not zip your document. No assignments sent by email will be graded.] 1. Develop an application in java (console application only) that accepts the following input from the user: name, address, date of birth, date hired, and annual salary for a new employee. It asks the user to enter date of birth of the new employce as well as the date shehe was hired in a strict format (MM/dd/yyyy) It then repeats the date entered in a different format (like "You entered: Sun Dec 12 00:00:00 EST 1999") for verification purposes. It then displays the entire data for the new employee. A test run may look like the following screenshot: Please note: You must use the following ingredients in your code: At least two classes (one being the driver class, the other the Employee class) Variables (instance and/or static) as required. Overloaded constructors to ensure flexibility in creating the Employee objects. Instance methods (non-static methods) that set and/or modify the values of the instance variables; methods that get the values of instance variables one by one. You may wish to add any enhancements to the application. However, please do not try this exercise in GUI.Explanation / Answer
import java.util.*;
import java.io.*;
import java.*;
class Employee
{
private String name;
private String address;
private String dob;
private String date_hired;
private int sal;
/*public String getname()
{
return name;
}
public String getaddress()
{
return address;
}
public void getdob()
{
return dob;
}
public void getdh()
{
return date_hired;
}
public void getsal()
{
return sal;
}*/
}
class solution
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
String name,address,dob,date_hired;
int sal;
Employee obj = new Employee();
System.out.println("Enter Name: ");
name = sc.next();
System.out.println("Enter Address: ");
address = sc.next();
//SimpleDateFormat myFormat = new SimpleDateFormat(" MM/dd/yyyy");
System.out.println("Enter date of birth: ");
dob = sc.nextLine();
//Date date1 = myFormat.parse(dob);
System.out.println("Enter date hired: ");
date_hired = sc.nextLine();
//Date date2 = myFormat.parse(date_hired);
//Calendar calendar = Calendar.getInstance(date1);
//System.out.println("You Entered:");
//char a = dob.charAt[0];
//char b = dob.charAt[1];
//System.out.println("You Entered:" + "a"+"b"+);
//System.out.println(calendar.getTime());
//calendar = Calendar.getInstance(date2);
//System.out.println("You Entered:");
//System.out.println(calendar.getTime());
System.out.println("Enter annual salary: ");
sal = sc.nextInt();
/*name = obj.getname();
System.out.println(name);
address = obj.getaddress();
System.out.println(name);
dob = obj.getdob();
System.out.println(dob);
date_hired = obj.getdate_hired();
System.out.println(date_hired);*/
System.out.println("Name:");
System.out.println(name);
System.out.println("Address:");
System.out.println(address);
System.out.println("Date of birth:");
System.out.println(dob);
System.out.println("Date hired:");
System.out.println(date_hired);
System.out.println("Salry:");
System.out.println(sal);
}
}