Question
import java.util.Scanner; public class employee_Detail { public static class Name { public String first= ; public String last= ; public Name() { first= ; last
import java.util.Scanner;
public class employee_Detail {
public static class Name { public String first=" "; public String last=" "; public Name() { first=" "; last =" "; } public String getFirst() { return first; } public String getLast() { return last; } public void setName(String first,String last) { this.first = first; this.last = last; } } public static class Date { public int month=0; public int day=0; public int year=0; public Date() { month=0; day=0; year=0; } public int getMonth() { return month; } public int getDay() { return day; } public int getYear() { return year; } public void setDate(int month,int day,int year) { this.month=month; this.day =day; this.year =year; } } public static class Address { public String street=" "; public String city=" "; public String state=" "; public int zip=0; public Address() { street=" "; city=" "; state=" "; zip=0; } public String getStreet() { return street; } public String getCity() { return city; } public String getState() { return state; } public int getZip() { return zip; } public void setAddress(String street,String city,String state,int zip) { this.street=street; this.city =city; this.state =state; this.zip =zip; } } public static class Employee { private int EmpNumb=0; private Name EmpName; private Address EmpAddress; private Date HireDate; public Employee() { EmpNumb=0; EmpName=new Name(); EmpAddress=new Address(); HireDate =new Date(); } public int getEmpNumb() { return EmpNumb; } public Name getEmpName() { EmpName.first=EmpName.getFirst(); EmpName.last =EmpName.getLast(); return EmpName; } public Address getEmpAddress() { EmpAddress.street=EmpAddress.getStreet(); EmpAddress.city =EmpAddress.getCity(); EmpAddress.state =EmpAddress.getState(); EmpAddress.zip =EmpAddress.getZip(); return EmpAddress; } public Date getHireDate() { HireDate.month=HireDate.getMonth(); HireDate.day =HireDate.getDay(); HireDate.year =HireDate.getYear(); return HireDate; } public void setEmpId(int Id) { EmpNumb=Id; } public void setEmpName(String first,String last) { EmpName.setName(first,last); } public void setHireDate(int month,int day,int year) { HireDate.setDate(month, day, year); } public void setEmpAddress(String street,String city,String state,int zip) { EmpAddress.setAddress(street, city, state, zip); } } public static void main(String[] args) { System.out.println("Enter the Number of Employee: "); Scanner scnr = new Scanner(System.in); int n=scnr.nextInt(); System.out.println("Enter the Data in Employee Array "); int Id; String first,last; int month,day,year; String street,city,state; int zip; Employee []EmpArr; EmpArr=new Employee[n]; for(int i=0;i }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started