From cd9ea10c82e0e9b82a53357920f7102a2d43ef51 Mon Sep 17 00:00:00 2001 From: Magid Date: Fri, 28 Jun 2024 14:16:12 -0400 Subject: [PATCH] ironhack --- .gitignore | 0 .idea/compiler.xml | 13 +++++ .idea/encodings.xml | 7 +++ .idea/jarRepositories.xml | 20 +++++++ .idea/misc.xml | 14 +++++ .idea/vcs.xml | 6 +++ .idea/workspace.xml | 90 +++++++++++++++++++++++++++++++ pom.xml | 30 +++++++++++ src/main/java/School/Course.java | 64 ++++++++++++++++++++++ src/main/java/School/Main.java | 22 ++++++++ src/main/java/School/Student.java | 68 +++++++++++++++++++++++ src/main/java/School/Teacher.java | 44 +++++++++++++++ 12 files changed, 378 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 pom.xml create mode 100644 src/main/java/School/Course.java create mode 100644 src/main/java/School/Main.java create mode 100644 src/main/java/School/Student.java create mode 100644 src/main/java/School/Teacher.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..dc0150e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..df00c07 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..41b6f2a --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + { + "associatedIndex": 0 +} + + + + + + + + + + + + + + + + + + + + + + + + + + 1719532689552 + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..867db99 --- /dev/null +++ b/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.example + IronSchool + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + + + org.junit.jupiter + junit-jupiter-api + 5.10.2 + test + + + + + + + + diff --git a/src/main/java/School/Course.java b/src/main/java/School/Course.java new file mode 100644 index 0000000..df39382 --- /dev/null +++ b/src/main/java/School/Course.java @@ -0,0 +1,64 @@ +package School; + +public class Course { + private static final java.util.UUID UUID = java.util.UUID.randomUUID(); + private final String courseId; + private String name; + private double price; + private double moneyEarned; + private Teacher teacher; + + // Parameterized constructor + public Course(String name, double price) { + this.courseId = java.util.UUID.randomUUID().toString(); + this.name = name; + this.price = price; + this.moneyEarned = 0.0; + this.teacher = null; + } + // Getter for courseId + public String getCourseId() { + return courseId; + } + + // Getter for name + public String getName() { + return name; + } + + // Setter for name + public void setName(String name) { + this.name = name; + } + + // Getter for price + public double getPrice() { + return price; + } + + // Setter for price + public void setPrice(double price) { + this.price = price; + } + + // Getter for moneyEarned + public double getMoneyEarned() { + return moneyEarned; + } + + // Setter for moneyEarned + public void setMoneyEarned(double moneyEarned) { + this.moneyEarned = moneyEarned; + } + + // Getter for teacher + public Teacher getTeacher() { + return teacher; + } + + // Setter for teacher + public void setTeacher(Teacher teacher) { + this.teacher = teacher; + } + } + diff --git a/src/main/java/School/Main.java b/src/main/java/School/Main.java new file mode 100644 index 0000000..2d7de8a --- /dev/null +++ b/src/main/java/School/Main.java @@ -0,0 +1,22 @@ +package School; + +public class Main { + public static void main(String[] args) { + Teacher teacher = new Teacher("John Peters", 50000); + Course course = new Course("Java 101", 200); + Student student = new Student("Maria Guitar", "134 Main St", "Maria@gmail.com"); + + // Accessing and printing the initial values + System.out.println("Student ID: " + student.getStudentId()); + System.out.println("Name: " + student.getName()); + + + } + + /* + How to upload + 1º git add . + 2º git commit -m "message" + 3º git push + */ +} \ No newline at end of file diff --git a/src/main/java/School/Student.java b/src/main/java/School/Student.java new file mode 100644 index 0000000..194ca44 --- /dev/null +++ b/src/main/java/School/Student.java @@ -0,0 +1,68 @@ +package School; + + import java.util.UUID; + + public class Student { + // Private members + private final String studentId; + private String name; + private String address; + private String email; + private Course course; + + // Parameterized constructor + public Student(String name, String address, String email) { + this.studentId = UUID.randomUUID().toString(); // Auto-generated unique ID + this.name = name; + this.address = address; + this.email = email; + this.course = null; + } + + // Getter for studentId + public String getStudentId() { + return studentId; + } + + // Getter for name + public String getName() { + return name; + } + + // Setter for name + public void setName(String name) { + this.name = name; + } + + // Getter for address + public String getAddress() { + return address; + } + + // Setter for address + public void setAddress(String address) { + this.address = address; + } + + // Getter for email + public String getEmail() { + return email; + } + + // Setter for email + public void setEmail(String email) { + this.email = email; + } + + // Getter for course + public Course getCourse() { + return course; + } + + // Setter for course + public void setCourse(Course course) { + this.course = course; + } + } + + diff --git a/src/main/java/School/Teacher.java b/src/main/java/School/Teacher.java new file mode 100644 index 0000000..e574a5e --- /dev/null +++ b/src/main/java/School/Teacher.java @@ -0,0 +1,44 @@ +package School; + + import java.util.UUID; + + public class Teacher { + // Private members + private final String teacherId; + private String name; + private double salary; + + // Parameterized constructor + public Teacher(String name, double salary) { + this.teacherId = UUID.randomUUID().toString(); // Auto-generated unique ID + this.name = name; + this.salary = salary; + } + + // Getter for teacherId + public String getTeacherId() { + return teacherId; + } + + // Getter for name + public String getName() { + return name; + } + + // Setter for name + public void setName(String name) { + this.name = name; + } + + // Getter for salary + public double getSalary() { + return salary; + } + + // Setter for salary + public void setSalary(double salary) { + this.salary = salary; + } + } + +