Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/lab-java-standard-input-and-classes.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
52 changes: 52 additions & 0 deletions src/main/Employee.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package main;

public class Employee {
protected String name;
protected String email;
protected int age;
protected double salary;

public Employee(String name, String email, int age, double salary) {
this.name=name;
this.email= email;
this.age=age;
this.salary=salary;
}


public String getName(){
return name;

}

public String getEmail(){
return email;
}

public int getAge(){
return age;
}

public double getSalary(){
return salary;
}


public void setName(String name){
this.name=name;

}
public void setEmail(String email){
this.email=email;

}

public void setAge(int age){
this.age=age;

}

public void setSalary(double salary){
this.salary=salary;
}
}
31 changes: 31 additions & 0 deletions src/main/Intern.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package main;

public class Intern extends Employee {
private final double MAX_INTERN_SALARY=20000;

public Intern(String name, String email, int age, double salary){ super(name,email,age,salary);
if(salary>MAX_INTERN_SALARY){
System.err.println("Intern salary should not above 20000");
}

}

public void setSalary(double salary){
if(salary>MAX_INTERN_SALARY){
System.err.println("Intern salary should not above 20000");

}
else{
super.setSalary(salary);
}
}

public double getInternSalary(){
return salary;
}

public double getMAX_INTERN_SALARY(){
return MAX_INTERN_SALARY;
}

}
34 changes: 34 additions & 0 deletions src/main/main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main;

import java.io.FileWriter;
import java.io.IOException;
import java.lang.ref.WeakReference;

public class main {

public static void main() throws IOException {
Employee[] employees=new Employee[10];
employees[0]=new Employee("Yaqut","yaqut@gmail.com", 20, 3000);

employees[1]=new Employee("Aysun","aysun@gmail.com", 20, 3000);
employees[2]=new Employee("Vusale","vusu@gmail.com", 20, 20);
employees[4]=new Employee("Nezrin","nezrin@gmail.com", 20, 2500);
employees[5]=new Employee("Murad","murad@gmail.com", 15, 1500);
employees[6]=new Employee("konbili","konbili@gmail.com", 20, 3000);
employees[7]=new Employee("gunay","gunay@gmail.com", 20, 30);
employees[8]=new Employee("nihad","nihad@gmail.com", 20, 600);
employees[9]=new Employee("emin","emin@gmail.com", 20, 700);

try (FileWriter writer = new FileWriter("employees.txt")){
for(int i=0; i<10; i++){
writer.write("name"+employees[i].getName()+"\n");
writer.write("email"+employees[i].getEmail()+ "\n");
writer.write("age"+employees[i].getAge()+ "\n");
writer.write("Salary"+employees[i].getSalary()+ "\n");

}
}


}
}