-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeapon.java
58 lines (47 loc) · 929 Bytes
/
Weapon.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
package com.mycompany.weapon;
class Weapons
{
String name;
public Weapons(String name)
{
this.name = name;
}
public void displayWeapons()
{
System.out.println("Gun: " + name);
}
}
class Assault_Rifle extends Weapons
{
public Assault_Rifle(String name)
{
super(name);
}
}
class SMG extends Weapons
{
public SMG(String name)
{
super(name);
}
}
class Marksman extends Weapons
{
public Marksman(String name)
{
super(name);
}
}
public class Weapon
{
public static void main(String[] args)
{
System.out.println("Weapons");
Weapons assault_rifle = new Assault_Rifle("Krig 6");
Weapons smg = new SMG("MP5");
Weapons marksman = new Marksman("Kar98k");
assault_rifle.displayWeapons();
smg.displayWeapons();
marksman.displayWeapons();
}
}