import java.io.*;
class Emp
{
String name, course,empname,dept,desig;
int age;
double salary;
Emp(String name, int age, String dept)
{
name=name;
age=age;
System.out.println("Employee Information:");
System.out.println("Constructor one");
System.out.println("Name :" +name);
System.out.println("Age :" +age);
System.out.println("Course :" +dept);
}
Emp(String desig, double salary)
{
desig=desig;
salary=salary;
System.out.println("Constructor two");
System.out.println("Designation :" +desig);
System.out.println("Salary :" +salary);
}
}
class MainConst
{
public static void main(String args[ ])throws IOException
{
String name,dept,desig;
int age;
double salary;
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter Employee Information");
System.out.println("Enter name:");
name=in.readLine();
System.out.println("Enter age:");
age=Integer.parseInt(in.readLine());
System.out.println("Enter department:");
dept=in.readLine();
System.out.println("Enter designation:");
desig=in.readLine();
System.out.println("Enter salary:");
salary=Double.valueOf(in.readLine()).doubleValue();
Emp e=new Emp(name,age,dept);
Emp e2=new Emp(desig,salary);
}
}
class Emp
{
String name, course,empname,dept,desig;
int age;
double salary;
Emp(String name, int age, String dept)
{
name=name;
age=age;
System.out.println("Employee Information:");
System.out.println("Constructor one");
System.out.println("Name :" +name);
System.out.println("Age :" +age);
System.out.println("Course :" +dept);
}
Emp(String desig, double salary)
{
desig=desig;
salary=salary;
System.out.println("Constructor two");
System.out.println("Designation :" +desig);
System.out.println("Salary :" +salary);
}
}
class MainConst
{
public static void main(String args[ ])throws IOException
{
String name,dept,desig;
int age;
double salary;
DataInputStream in=new DataInputStream(System.in);
System.out.println("Enter Employee Information");
System.out.println("Enter name:");
name=in.readLine();
System.out.println("Enter age:");
age=Integer.parseInt(in.readLine());
System.out.println("Enter department:");
dept=in.readLine();
System.out.println("Enter designation:");
desig=in.readLine();
System.out.println("Enter salary:");
salary=Double.valueOf(in.readLine()).doubleValue();
Emp e=new Emp(name,age,dept);
Emp e2=new Emp(desig,salary);
}
}
No comments :
Post a Comment