-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathEmployee.java
More file actions
46 lines (46 loc) · 1.33 KB
/
Employee.java
File metadata and controls
46 lines (46 loc) · 1.33 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
import java.util.*;
class Employee
{
int age;
long days;
long salary;
long overtime;
long phone;
String name;
long gross;
double rate;
void accept()
{
Scanner Scan=new Scanner(System.in);
System.out.print("Enter your name: ");
name=Scan.next();
System.out.print("Enter your Phone No.: ");
phone=Scan.nextLong();
System.out.print("Enter your age: ");
age=Scan.nextInt();
System.out.print("Enter your Basic Salary: ");
salary=Scan.nextLong();
System.out.print("Total present days: ");
days=Scan.nextInt();
System.out.print("Enter Overtime(in hrs): ");
overtime=Scan.nextInt();
System.out.print("Enter rate: ");
rate=Scan.nextDouble();
gross = (long) ((salary*days/30)+(overtime*rate));
days= days + overtime/24;
}
void display()
{
System.out.println("\nName: "+name);
System.out.println("Phone No.: "+phone);
System.out.println("Age: "+age);
System.out.println("Present days: "+days);
System.out.println("Gross Salary: "+gross);
}
public static void main(String args[])
{
Employee obj=new Employee();
obj.accept();
obj.display();
}
}