esoe
2 years ago
12 changed files with 64 additions and 2 deletions
Binary file not shown.
@ -1,6 +1,11 @@ |
|||||||
package ru.molokoin; |
package ru.molokoin; |
||||||
|
|
||||||
public class App { |
public class App { |
||||||
public static void main(String[] args) { |
public static void main(String[] args) { |
||||||
System.out.println("qq"); |
//int[] array = {10, 2, 120,324,8,0};
|
||||||
|
Person[] array = new Person[2]; |
||||||
|
array[0] = new Person("Ivan", "Ivanov"); |
||||||
|
array[1] = new Soldier("Aleksey", "Alekseev", MilitarySpeciality.GUNLAYER); |
||||||
|
array[1].toString(); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,5 @@ |
|||||||
|
package ru.molokoin; |
||||||
|
|
||||||
|
public class Employe { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package ru.molokoin; |
||||||
|
|
||||||
|
public enum MilitarySpeciality { |
||||||
|
RADIOOPERATOR, |
||||||
|
TANKMAN, |
||||||
|
GUNLAYER, |
||||||
|
DRIVER; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package ru.molokoin; |
||||||
|
|
||||||
|
public class Person { |
||||||
|
private String firstname; |
||||||
|
private String lastname; |
||||||
|
public Person(String firstname, String lastname){ |
||||||
|
setFirstname(firstname); |
||||||
|
setLastname(lastname); |
||||||
|
} |
||||||
|
|
||||||
|
public String getFirstname() { |
||||||
|
return firstname; |
||||||
|
} |
||||||
|
public void setFirstname(String firstname) { |
||||||
|
this.firstname = firstname; |
||||||
|
} |
||||||
|
public String getLastname() { |
||||||
|
return lastname; |
||||||
|
} |
||||||
|
public void setLastname(String lastname) { |
||||||
|
this.lastname = lastname; |
||||||
|
} |
||||||
|
@Override |
||||||
|
public String toString(){ |
||||||
|
return "firstname: " + getFirstname() + " : " + "Lastname: " + getLastname(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package ru.molokoin; |
||||||
|
|
||||||
|
public class Soldier extends Person{ |
||||||
|
private MilitarySpeciality militarySpeciality; |
||||||
|
public Soldier(String firstname, String lastname, MilitarySpeciality militarySpeciality){ |
||||||
|
super(firstname, lastname); |
||||||
|
setMilitarySpeciality(militarySpeciality); |
||||||
|
|
||||||
|
} |
||||||
|
public MilitarySpeciality getMilitarySpeciality() { |
||||||
|
return militarySpeciality; |
||||||
|
} |
||||||
|
public void setMilitarySpeciality(MilitarySpeciality militarySpeciality) { |
||||||
|
this.militarySpeciality = militarySpeciality; |
||||||
|
} |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue