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