diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/lab-java-standard-input-and-classes.iml b/.idea/lab-java-standard-input-and-classes.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/lab-java-standard-input-and-classes.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..e6be3f1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..98573fc --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lab-input-and-classes/lab-input-and-classes.iml b/lab-input-and-classes/lab-input-and-classes.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/lab-input-and-classes/lab-input-and-classes.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/lab-input-and-classes/src/Employee.java b/lab-input-and-classes/src/Employee.java new file mode 100644 index 0000000..036884a --- /dev/null +++ b/lab-input-and-classes/src/Employee.java @@ -0,0 +1,55 @@ +public class Employee { + private String name; + private String email; + private int age; + private double salary; + + public Employee(String name, String email, int age, double salary) { + setName(name); + setEmail(email); + setAge(age); + setSalary(salary); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + + @Override + public String toString() { + return "Employee{" + + "name='" + name + '\'' + + ", email='" + email + '\'' + + ", age=" + age + + ", salary=" + salary + + '}'; + } +} diff --git a/lab-input-and-classes/src/Intern.java b/lab-input-and-classes/src/Intern.java new file mode 100644 index 0000000..ed8f7e7 --- /dev/null +++ b/lab-input-and-classes/src/Intern.java @@ -0,0 +1,18 @@ +public class Intern extends Employee{ + private static final double SALARY_LIMIT = 20000; + private double salary; + + public Intern(String name, String email, int age, double salary){ + super(name, email, age, salary); + setSalary(salary); + } + + public double getSalary(){ + return this.salary; + } + + public void setSalary(double salary){ + this.salary = Math.min(salary, SALARY_LIMIT); + } + +} diff --git a/lab-input-and-classes/src/Main.java b/lab-input-and-classes/src/Main.java new file mode 100644 index 0000000..913104b --- /dev/null +++ b/lab-input-and-classes/src/Main.java @@ -0,0 +1,16 @@ +import javax.sound.midi.Soundbank; + +//TIP To Run code, press or +// click the icon in the gutter. +public class Main { + public static void main(String[] args) { + + Employee employee1 = new Employee("Henry", "henry@example.com", 46, 30000); + Intern intern1 = new Intern("John", "john@example.com", 33, 10000); + + System.out.println(employee1.getEmail()); + System.out.println(intern1.getSalary()); + + + } +} \ No newline at end of file diff --git a/out/production/lab-input-and-classes/Employee.class b/out/production/lab-input-and-classes/Employee.class new file mode 100644 index 0000000..7edbfa0 Binary files /dev/null and b/out/production/lab-input-and-classes/Employee.class differ diff --git a/out/production/lab-input-and-classes/Intern.class b/out/production/lab-input-and-classes/Intern.class new file mode 100644 index 0000000..d8ed87b Binary files /dev/null and b/out/production/lab-input-and-classes/Intern.class differ diff --git a/out/production/lab-input-and-classes/Main.class b/out/production/lab-input-and-classes/Main.class new file mode 100644 index 0000000..2a9a005 Binary files /dev/null and b/out/production/lab-input-and-classes/Main.class differ