-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWorker.java
91 lines (68 loc) · 2.51 KB
/
Worker.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.mycompany.practic1;
/**
*
* @author basal
*/
public class Worker extends Person {
int salary; //Salary per hour
private String workSchedule;
private int workHours;
private String jobName;
//Конструкторы
public Worker(int salary, String workSchedule, int workHours, String jobName, String name, String birthDate, String country) {
super(name, birthDate, country);
this.salary = salary;
this.workSchedule = workSchedule;
this.workHours = workHours;
this.jobName = jobName;
}
public Worker(int salary, String workSchedule, int workHours, String jobName, String name, String birthDate) {
super(name, birthDate);
this.salary = salary;
this.workSchedule = workSchedule;
this.workHours = workHours;
this.jobName = jobName;
}
public Worker(int salary, String workSchedule, int workHours, String jobName, String name) {
super(name);
this.salary = salary;
this.workSchedule = workSchedule;
this.workHours = workHours;
this.jobName = jobName;
}
//Войды
public void goToWork() {
System.out.println("A worker is on a ride to his work");
}
public void doTheWork () {
System.out.println("Worker is working and waiting the end of the workday (Hell)");
}
public void lunchAtWork () {
System.out.println("Worker is having a lunch");
}
public void getPaid () {
System.out.println("Woker is getting paid for his job");
System.out.println("Your today's Salary is " + (this.salary*workHours));
}
public int getSalary() {
return salary;
}
public String getWorkSchedule() {
return workSchedule;
}
public int getWorkHours() {
return workHours;
}
public String getJobName() {
return jobName;
}
@Override
public String toString() {
return "Worker{" + "name=" + getName() + ", birthDate=" + getBirthDate() + ", country=" + getCountry() + "salary=" + salary + ", workSchedule="
+ workSchedule + ", workHours=" + workHours + ", jobName=" + jobName + "}";
}
}