-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInhetance.java
More file actions
65 lines (62 loc) · 1.11 KB
/
Copy pathInhetance.java
File metadata and controls
65 lines (62 loc) · 1.11 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
import java.util.Scanner;
class a{
String name;
int id;
float salary;
void set_name(String n)
{
name=n;
}
String get_name()
{
return name;
}
void set_id(int i)
{
id=i;
}
int get_id()
{
return id;
}
void set_salary(float s)
{
salary=s;
}
float get_salary()
{
return salary;
}
}
class b extends a
{
public void show()
{
System.out.println("enter the print name,id,salary:\n");
Scanner sc=new Scanner(System.in);
name=sc.nextLine();
id=sc.nextInt();
salary=sc.nextFloat();
set_name(name);
set_id(id);
set_salary(salary);
System.out.println(get_name());
System.out.println(get_id());
System.out.println(get_salary());
}
}
public class Inhetance {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
float bonous;
float d;
b c=new b();
c.show();
System.out.println("enter the bonus rate:\n");
bonous=sc.nextFloat();
d=(bonous*c.get_salary())/100;
System.out.println("the total salary with bonous is:\n");
System.out.println(d);
}
}