-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssign2.java
More file actions
68 lines (63 loc) · 1.77 KB
/
Assign2.java
File metadata and controls
68 lines (63 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.google;
/*
Author: Vaibhavi Dixit
code for generate ID card of employees
* */
abstract class Employee{
//fields for employee
int idNo;
String name;
String company;
String dept;
String edu;
long phone;
String email;
//parameterized constructor
Employee(int idNo,String name, String company, String dept, String edu, long phone, String email){
this.company=company;
this.dept=dept;
this.edu=edu;
this.email=email;
this.idNo=idNo;
this.name=name;
this.phone=phone;
}
abstract public void IdCard();
}
class ID extends Employee{
ID(int idNo,String name, String company, String dept, String edu, long phone, String email){
super(idNo,name,company,dept,edu,phone,email);
}
//abstract method implementation
@Override
public void IdCard() {
System.out.println("************************");
System.out.println(company);
System.out.println("************************");
System.out.print("ID: "+idNo);
System.out.println("Name: "+name);
System.out.println("Dept: "+dept);
System.out.println("Edu: "+edu);
System.out.println("Phone: "+phone);
System.out.println("Email: "+email);
System.out.println("************************");
}
}
public class Assign2 {
public static void main(String[] args) {
ID i1=new ID(101,"Shiv Desai","Wipro Limited Corporation","Sales","BTech CS",1206733,"shiv123@gmail.com");
i1.IdCard();
}//main method ends
}//Assign2 ends
//output
/*
************************
Wipro Limited Corporation
************************
ID: 101Name: Shiv Desai
Dept: Sales
Edu: BTech CS
Phone: 1206733
Email: shiv123@gmail.com
************************
* */