-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabc.java
More file actions
31 lines (29 loc) · 895 Bytes
/
abc.java
File metadata and controls
31 lines (29 loc) · 895 Bytes
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
import java.util.Scanner;
class Employee{
int ID, salary;
String name;
Employee(int ID, String name, int salary){
this.ID=ID;
this.name=name;
this.salary=salary;
}
void raise(int percent){
int incre=this.salary*percent/100;
this.salary +=incre;
}
}
class abc{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("ID");
int ID=sc.nextInt();
System.out.println("salary");
int salary=sc.nextInt();
System.out.println("Name");
String name=sc.nextLine();
Employee emp= new Employee(ID,name,salary);
emp.raise(20);
System.out.println("Rasied Salary:" +emp.salary);
sc.close();
}
}