diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..278b59f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+# Default ignored files
+/shelf/
+/.idea/workspace.xml
+
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/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..919ce1f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..f0d9157
--- /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/homework-java-ironschool.iml b/.idea/homework-java-ironschool.iml
new file mode 100644
index 0000000..c03b9b2
--- /dev/null
+++ b/.idea/homework-java-ironschool.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ 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..de4b033
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
\ 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/pom.xml b/pom.xml
new file mode 100644
index 0000000..97581e5
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,26 @@
+
+
+ 4.0.0
+
+ groupId
+ homework-java-ironschool
+ 1.0-SNAPSHOT
+
+
+ 21
+ 21
+ UTF-8
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.9.1
+ test
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/Application.java b/src/main/java/Application.java
new file mode 100644
index 0000000..d74e880
--- /dev/null
+++ b/src/main/java/Application.java
@@ -0,0 +1,81 @@
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Scanner;
+
+public class Application {
+
+ public static void main(String[] args) {
+
+ createSchoolName();
+ teacherDetails();
+ }
+
+ private static final Scanner scanner = new Scanner(System.in);
+
+ private static void createSchoolName() {
+ System.out.println("Welcome to the School Application");
+ System.out.println("Please enter the name of the school:");
+
+ String schoolName = scanner.nextLine();
+ System.out.println("Your school is: " + schoolName);
+
+ }
+
+ private static int number(SchoolComponents classToCount) {
+ int number;
+
+ do {
+ System.out.println(String.format("How many %s are there in the school: ", classToCount));
+ while (!scanner.hasNextInt()) {
+ System.out.println(String.format("Please enter a valid number for the %s ", classToCount));
+ scanner.next();
+ }
+ number = scanner.nextInt();
+
+ if (number <= 0) {
+ System.err.println(String.format("The number of %s can't be 0 or negative", classToCount));
+ } else if (number == 1) {
+ System.out.println(String.format("In your school there is only " + number + " %s", classToCount));
+ } else {
+ System.out.println(String.format("In your school there are " + number + " %s", classToCount));
+ }
+
+ } while (number <= 0);
+
+ return number;
+
+ }
+
+ private static Map teacherDetails() {
+ Map teachersMap = new HashMap<>();
+ int number = number(SchoolComponents.TEACHERS);
+ scanner.nextLine();
+ for (int i = 0; i < number; i++) {
+ System.out.println("Enter details for Teacher " + (i + 1) + ":");
+
+ System.out.println("Name: ");
+ String name = scanner.nextLine();
+
+ System.out.println("Salary: ");
+ double salary = Double.parseDouble(scanner.nextLine());
+
+ Teacher teacher = new Teacher(name, salary);
+ teachersMap.put(teacher.getTeacherId(), teacher);
+ }
+
+ /*for (Map.Entry entry : teachersMap.entrySet()) {
+ System.out.println("Teacher ID: " + entry.getKey() + ", Name: " + entry.getValue().getName() + ", Salary: " + entry.getValue().getSalary());
+ }*/
+
+ return teachersMap;
+
+ }
+
+
+
+}
+
+
+
+
diff --git a/src/main/java/Commands.java b/src/main/java/Commands.java
new file mode 100644
index 0000000..48470b0
--- /dev/null
+++ b/src/main/java/Commands.java
@@ -0,0 +1,194 @@
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class Commands {
+ private Map courseList = new HashMap<>();
+ private Map studentList = new HashMap<>();
+ private Map teacherList = new HashMap<>();
+
+
+ public Commands(Map courseList, Map studentList, Map teacherList) {
+ setCourseList(courseList);
+ setStudentList(studentList);
+ setTeacherList(teacherList);
+ }
+
+ public Map getCourseList() {
+ return courseList;
+ }
+
+ public void setCourseList(Map courseList) {
+ this.courseList = courseList;
+ }
+
+ public Map getStudentList() {
+ return studentList;
+ }
+
+ public void setStudentList(Map studentList) {
+ this.studentList = studentList;
+ }
+
+ public Map getTeacherList() {
+ return teacherList;
+ }
+
+ public void setTeacherList(Map teacherList) {
+ this.teacherList = teacherList;
+ }
+
+ public void commandSelector(CommandEnum commandAction){
+ String studentID = "asdfasdf";
+ String courseID = "asdfasdf";
+ String teacherID = "asdfasdf";
+
+ switch (commandAction){
+ case ENROLL:
+ enroll(studentID,courseID);
+
+ break;
+ case ASSIGN:
+ assign(teacherID,courseID);
+ break;
+
+ case SHOW_COURSES:
+ ShowCourses();
+ break;
+
+ case LOOKUP_COURSE:
+ LookupCourse(courseID);
+ break;
+
+ case SHOW_STUDENTS:
+ ShowStudents();
+ break;
+
+ case LOOKUP_STUDENT:
+ LookupStudent(studentID);
+ break;
+
+ case SHOW_TEACHERS:
+ ShowTeachers();
+ break;
+
+ case LOOKUP_TEACHER:
+ LookupTeacher(teacherID);
+ break;
+
+ case SHOW_PROFIT:
+ ShowProfit();
+ break;
+
+ default:
+ System.err.println("The command selected is not available");
+ break;
+ }
+ }
+
+ public void enroll(Student studentID, Course courseID) {
+ Course course = courseID;
+ Student student = studentID;
+
+ courseID.courseEnroll(studentID, courseID);
+
+ // Increase money earned
+ courseID.setMoney_earned(courseID.getMoney_earned() + courseID.getPrice());
+ }
+
+ public void assign(Teacher teacherID,Course courseID){ //This command will help assign the teacher specified to the corresponding course
+ Teacher teacher = teacherID;
+
+ courseID.setTeacher(teacherID);
+ }
+
+ public void ShowCourses(){ //This command will display a list of all courses
+ for (Course course : courseList.values()){
+ System.out.println(course.getName());
+ };
+ }
+
+ public void LookupCourse(String courseID){ // This command will display the full details of the specified course
+ Course x = courseList.get(courseID);
+
+ System.out.println(x.getName());
+ System.out.println(x.getPrice());
+ System.out.println(x.getTeacher());
+ System.out.println(x.getClass());
+ }
+
+ public void ShowStudents(){ //This command will display a list of all students
+ for (Student student : studentList.values()){
+ System.out.println(student.getName());
+ }
+ }
+
+ public void LookupStudent(Student studentID){ //This command will display the full details of the specified student
+ Student student = studentList.get(studentID);
+
+ System.out.println(student.getName());
+ System.out.println(student.getAddress());
+ System.out.println(student.getCourse());
+ System.out.println(student.getEmail());
+ }
+
+ public void ShowTeachers(){ //This command will display a list of all teachers
+ for (Teacher teacher : teacherList.values()){
+ System.out.println(teacher.getName());
+ System.out.println("List of Courses: ");
+ for (Map.Entry entry : courseList.entrySet()) {
+ System.out.println(entry.getKey() + " : " + entry.getValue().getName());
+ }
+ }
+
+ public void LookupCourse(String courseID){ // This command will display the full details of the specified course
+ if(courseList.containsKey(courseID)) {
+ System.out.println("Course ID: " + courseID);
+ System.out.println("Course Name: " + courseList.get(courseID).getName());
+ System.out.println("Course Price: " + courseList.get(courseID).getPrice());
+ System.out.println("Course Money Earned: " + courseList.get(courseID).getMoney_earned());
+ System.out.println("Course Teacher: " + courseList.get(courseID).getTeacher().getName());
+ }
+ }
+
+ public void ShowStudents(){ //This command will display a list of all students
+ System.out.println("List of Students: ");
+ for (Map.Entry entry : studentList.entrySet()) {
+ System.out.println(entry.getKey() + " : " + entry.getValue().getName());
+ }
+ }
+
+ public void LookupStudent(String studentID){ //This command will display the full details of the specified student
+ if(studentList.containsKey(studentID)){
+ System.out.println("Student ID: " + studentID);
+ System.out.println("Student Name: " + studentList.get(studentID).getName());
+ System.out.println("Student Address: " + studentList.get(studentID).getAddress());
+ System.out.println("Student Email: " + studentList.get(studentID).getEmail());
+ System.out.println("Student Course: " + studentList.get(studentID).getCourse().getName());
+ }
+ }
+
+ public void ShowTeachers(){ //This command will display a list of all teachers
+ System.out.println("List of Teachers: ");
+ for (Map.Entry entry : teacherList.entrySet()) {
+ System.out.println(entry.getKey() + " : " + entry.getValue().getName());
+ }
+ }
+
+ public void LookupTeacher(String teacherID){ // This command will display the full details of the specified teacher
+ Teacher teacher = teacherList.get(teacherID);
+
+ System.out.println(teacher.getName());
+ System.out.println(teacher.getSalary());
+ System.out.println(teacher.getClass());
+ if(teacherList.containsKey(teacherID)){
+ System.out.println("Teacher ID: " + teacherID);
+ System.out.println("Teacher Name: " + teacherList.get(teacherID).getName());
+ System.out.println("Teacher Salary: " + teacherList.get(teacherID).getSalary());
+ }
+ }
+
+ public void ShowProfit(){ //This command will calculate (The total money earned from all courses) - (The sum of all the teachers' salaries) and return the result
+ }
+}
+
diff --git a/src/main/java/Course.java b/src/main/java/Course.java
new file mode 100644
index 0000000..b8e9f95
--- /dev/null
+++ b/src/main/java/Course.java
@@ -0,0 +1,64 @@
+
+import java.util.HashMap;
+import java.util.UUID;
+public class Course {
+ private String courseId;
+ private String name;
+
+
+ private double price;
+ private double money_earned;
+ private Teacher teacher;
+ private HashMap courseList = new HashMap();
+
+
+ public Course(String courseId, String name, double price, double money_earned) {
+ setCourseId(courseId);
+ setName(name);
+ setPrice(price);
+ }
+
+ public String getCourseId() {
+ return UUID.randomUUID().toString();
+ }
+
+ public void setCourseId(String courseId) {
+ this.courseId = courseId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public double getPrice() {
+ return price;
+ }
+
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ public double getMoney_earned() {
+ return money_earned;
+ }
+
+ public void setMoney_earned(double money_earned) {
+ this.money_earned = money_earned;
+ }
+
+ public Teacher getTeacher() {
+ return teacher;
+ }
+
+ public void setTeacher(Teacher teacher) {
+ this.teacher = teacher;
+ }
+
+ public void courseEnroll(Student student, Course x){
+ courseList.put(student.getStudentId(), x);
+ }
+}
diff --git a/src/main/java/SchoolComponents.java b/src/main/java/SchoolComponents.java
new file mode 100644
index 0000000..6bda028
--- /dev/null
+++ b/src/main/java/SchoolComponents.java
@@ -0,0 +1,20 @@
+public enum SchoolComponents {
+
+ TEACHERS ("teachers"),
+ STUDENTS ("students"),
+ COURSES ("courses");
+
+ private final String label;
+
+ SchoolComponents(String label) {
+ this.label = label;
+ }
+
+ @Override
+ public String toString() {
+ return label;
+ }
+
+
+
+}
diff --git a/src/main/java/Student.java b/src/main/java/Student.java
new file mode 100644
index 0000000..5a64817
--- /dev/null
+++ b/src/main/java/Student.java
@@ -0,0 +1,52 @@
+import java.util.UUID;
+
+public class Student {
+ private final String studentId;
+ private String name;
+ private String address;
+ private String email;
+ private Course course;
+
+ public Student(String name, String address, String email) {
+ this.studentId = UUID.randomUUID().toString();
+ this.name = name;
+ this.address = address;
+ this.email = email;
+ }
+
+ public String getStudentId() {
+ return studentId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Course getCourse() {
+ return course;
+ }
+
+ public void setCourse(Course course) {
+ this.course = course;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/Teacher.java b/src/main/java/Teacher.java
new file mode 100644
index 0000000..b45ec11
--- /dev/null
+++ b/src/main/java/Teacher.java
@@ -0,0 +1,40 @@
+import java.util.UUID;
+
+
+public class Teacher {
+ private final String teacherId;
+ private String name;
+ private double salary;
+
+ public Teacher(String name, double salary) {
+ this.teacherId = UUID.randomUUID().toString();
+ setName(name);
+ setSalary(salary);
+ }
+
+ public String getTeacherId() {
+ return teacherId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public double getSalary() {
+ return salary;
+ }
+
+ public boolean setSalary(double salary) {
+ if (salary < 0) {
+ return false;
+ } else {
+ this.salary = salary;
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/test.java b/src/test/java/test.java
new file mode 100644
index 0000000..e3bba97
--- /dev/null
+++ b/src/test/java/test.java
@@ -0,0 +1,4 @@
+
+public class test {
+
+}
diff --git a/target/classes/Application.class b/target/classes/Application.class
new file mode 100644
index 0000000..9f306e7
Binary files /dev/null and b/target/classes/Application.class differ
diff --git a/target/classes/Commands.class b/target/classes/Commands.class
new file mode 100644
index 0000000..472787d
Binary files /dev/null and b/target/classes/Commands.class differ
diff --git a/target/classes/Course.class b/target/classes/Course.class
new file mode 100644
index 0000000..8d886e0
Binary files /dev/null and b/target/classes/Course.class differ
diff --git a/target/classes/SchoolComponents.class b/target/classes/SchoolComponents.class
new file mode 100644
index 0000000..5e1d677
Binary files /dev/null and b/target/classes/SchoolComponents.class differ
diff --git a/target/classes/Student.class b/target/classes/Student.class
new file mode 100644
index 0000000..d79dc7b
Binary files /dev/null and b/target/classes/Student.class differ
diff --git a/target/classes/Teacher.class b/target/classes/Teacher.class
new file mode 100644
index 0000000..6f5d736
Binary files /dev/null and b/target/classes/Teacher.class differ