assignment3

This commit is contained in:
kaltinsoy 2024-12-20 04:20:11 +03:00
parent e07eec00f8
commit 16ffb9844f
6 changed files with 41 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,35 @@
class Human {
private String firstName;
private String lastName;
public Human (String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public String getFName() {
return firstName;
}
public String getLName() {
return lastName;
}
}
class Worker extends Human {
private String jobTitle;
public Worker (String firstName, String lastName, String jobTitle) {
super(firstName, lastName);
this.jobTitle = jobTitle;
}
public String getJobTitle() {
return jobTitle;
}
public String getLName() {
return super.getLName()+", "+jobTitle;
}
}

Binary file not shown.

View File

@ -0,0 +1,6 @@
public class HumanTest {
public static void main(String[] args) {
Worker worker = new Worker("Koray", "Altinsoy", "Embedded Systems Engineer");
System.out.println("First name: "+worker.getFName()+", Last Name: "+worker.getLName()+", Job Title:"+worker.getJobTitle());
}
}

Binary file not shown.