-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConstructon.java
91 lines (83 loc) · 2.48 KB
/
Constructon.java
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package constructon;
import java.util.ArrayList;
import java.util.Scanner;
public class Constructon {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input= new Scanner(System.in);
/*System.out.println("enter your data\n");
Scanner input=new Scanner(System.in);
Student student= new Student();
student.name=input.next();
student.rull=input.next();
student.dept=input.next();
student.varsity=input.next();
ArrayList<Student>arraylist= new ArrayList<Student>();
arraylist.add(student);
for(Student std:arraylist){
System.out.println(std.name+" "+std.rull+" "+std.dept+" "+std.varsity);
}*/
String emname,emsalary, emdept, varsity;
System.out.println("enter your data");
emname=input.next();
emsalary=input.next();
emdept=input.next();
varsity=input.next();
//Office office= new Office(emname, emsalary);
Office office1= new Office(emname);
/*office.employee= input.next();
office.salary= input.next();
office.latecome= input.next();
office.attent= input.next();
office.showofficeall();*/
/*office.setemployee("habib");
office.setesalary("10000");
office.setelatecome("21");
office.seteattent("7");*/
office1.showofficeall();
}
}
class Student{
String name="";
String rull="";
String dept="";
String varsity="";
}
class Office{
private String employee;
private String salary;
private String latecome;
private String attent;
Office(String employee, String salary){
this.employee=employee;
this.salary=salary;
}
Office(String employee){
this.employee=employee;
}
public String setemployee(String employee){
return this.employee=employee;
}
//public void getemployee(){
//return;
//}
public String setesalary(String salary){
return this.salary=salary;
}
public String setelatecome(String latecome){
return this.latecome=latecome;
}
public String seteattent(String attent){
return this.attent=attent;
}
public void showofficeall(){
if(salary==null){
System.out.println(employee+" "+latecome+" "+attent);
return;
}
System.out.println(employee+" "+salary+" "+latecome+" "+attent);
return;
}
}