From 29a5d72b7ff56d437b73d1862443d497e86b5a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwardin231=E2=80=9D?= Date: Sat, 24 Feb 2024 10:26:44 +0100 Subject: [PATCH 01/22] Maven added, David Student class and Darwin Course class --- .idea/.gitignore | 3 ++ .idea/homework-java-ironschool.iml | 10 ++++++ .idea/misc.xml | 14 ++++++++ .idea/modules.xml | 8 +++++ .idea/vcs.xml | 6 ++++ main/java/Course.java | 57 ++++++++++++++++++++++++++++++ main/java/Student.java | 44 +++++++++++++++++++++++ pom.xml | 26 ++++++++++++++ 8 files changed, 168 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/homework-java-ironschool.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 main/java/Course.java create mode 100644 main/java/Student.java create mode 100644 pom.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/homework-java-ironschool.iml b/.idea/homework-java-ironschool.iml new file mode 100644 index 0000000..76c2124 --- /dev/null +++ b/.idea/homework-java-ironschool.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..fdc35ea --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7d98804 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ 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/main/java/Course.java b/main/java/Course.java new file mode 100644 index 0000000..329885a --- /dev/null +++ b/main/java/Course.java @@ -0,0 +1,57 @@ + +import java.util.UUID; +public class Course { + private String courseId; + private String name; + private double price; + private double money_earned; + //private Teacher teacher; Add it once Teacher class is created + + + public Course(String courseId, String name, double price, double money_earned) { + setCourseId(courseId); + setName(name); + setPrice(price); + setMoney_earned(money_earned); + } + + 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; + }*/ +} diff --git a/main/java/Student.java b/main/java/Student.java new file mode 100644 index 0000000..4153e47 --- /dev/null +++ b/main/java/Student.java @@ -0,0 +1,44 @@ +import java.util.UUID; +public class Student { + private String studentId; + private String name; + private String address; + private String email; + private Course course; + public Student(String name, String address, String email) { + this.name = name; + this.address = address; + this.email = email; + this.studentId = generateStudentId(); + } + public String getStudentId() { + return studentId; + } + public String generateStudentId() { + return UUID.randomUUID().toString(); + } + 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/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 From 94505a4746a9d93cc69f4a76e8090cf88405d249 Mon Sep 17 00:00:00 2001 From: Xavi Soria Date: Sat, 24 Feb 2024 10:31:14 +0100 Subject: [PATCH 02/22] Teacher commit --- main/java/Teacher.java | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 main/java/Teacher.java diff --git a/main/java/Teacher.java b/main/java/Teacher.java new file mode 100644 index 0000000..2c8d1df --- /dev/null +++ b/main/java/Teacher.java @@ -0,0 +1,39 @@ +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 void setSalary(double salary) { + if (salary < 0) { + throw new IllegalArgumentException("Salary cannot be negative"); + } else { + this.salary = salary; + } + } + +} \ No newline at end of file From c83641bb41135323b0a2720f3983b09b871fecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwardin231=E2=80=9D?= Date: Sat, 24 Feb 2024 10:31:36 +0100 Subject: [PATCH 03/22] Maven set --- .idea/homework-java-ironschool.iml | 4 ++-- {main => src/main}/java/Course.java | 0 {main => src/main}/java/Student.java | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename {main => src/main}/java/Course.java (100%) rename {main => src/main}/java/Student.java (100%) diff --git a/.idea/homework-java-ironschool.iml b/.idea/homework-java-ironschool.iml index 76c2124..c03b9b2 100644 --- a/.idea/homework-java-ironschool.iml +++ b/.idea/homework-java-ironschool.iml @@ -3,8 +3,8 @@ - - + + \ No newline at end of file diff --git a/main/java/Course.java b/src/main/java/Course.java similarity index 100% rename from main/java/Course.java rename to src/main/java/Course.java diff --git a/main/java/Student.java b/src/main/java/Student.java similarity index 100% rename from main/java/Student.java rename to src/main/java/Student.java From 22900cad58c892d0704cd0fbcd536bc4a4e0a2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwardin231=E2=80=9D?= Date: Sat, 24 Feb 2024 10:35:29 +0100 Subject: [PATCH 04/22] Maven set --- src/main/java/Course.java | 2 ++ src/test/java/test.java | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 src/test/java/test.java diff --git a/src/main/java/Course.java b/src/main/java/Course.java index 329885a..9fce2c2 100644 --- a/src/main/java/Course.java +++ b/src/main/java/Course.java @@ -3,6 +3,8 @@ public class Course { private String courseId; private String name; + + private double price; private double money_earned; //private Teacher teacher; Add it once Teacher class is created 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 { + +} From a0d3cb2b7912e0d049673dba84ad42e4f9cbe1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwardin231=E2=80=9D?= Date: Sat, 24 Feb 2024 10:36:38 +0100 Subject: [PATCH 05/22] Teacher class added to Course.java --- src/main/java/Course.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/Course.java b/src/main/java/Course.java index 9fce2c2..3503218 100644 --- a/src/main/java/Course.java +++ b/src/main/java/Course.java @@ -7,7 +7,7 @@ public class Course { private double price; private double money_earned; - //private Teacher teacher; Add it once Teacher class is created + private Teacher teacher; public Course(String courseId, String name, double price, double money_earned) { @@ -49,11 +49,11 @@ public void setMoney_earned(double money_earned) { this.money_earned = money_earned; } - /*public Teacher getTeacher() { + public Teacher getTeacher() { return teacher; } public void setTeacher(Teacher teacher) { this.teacher = teacher; - }*/ + } } From 308ebaf1a02ed23cb5ec5f913b875c7e271c860c Mon Sep 17 00:00:00 2001 From: Xavi Soria Date: Sat, 24 Feb 2024 11:16:31 +0100 Subject: [PATCH 06/22] Teacher commit 2 --- src/main/java/Teacher.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/Teacher.java b/src/main/java/Teacher.java index 2c8d1df..b45ec11 100644 --- a/src/main/java/Teacher.java +++ b/src/main/java/Teacher.java @@ -28,12 +28,13 @@ public double getSalary() { return salary; } - public void setSalary(double salary) { + public boolean setSalary(double salary) { if (salary < 0) { - throw new IllegalArgumentException("Salary cannot be negative"); + return false; } else { this.salary = salary; } + return true; } } \ No newline at end of file From ed8dc6d3d83a3450e205ba0c4c7ff9d60e26f8f1 Mon Sep 17 00:00:00 2001 From: Xavi Soria Date: Sat, 24 Feb 2024 11:21:16 +0100 Subject: [PATCH 07/22] fix teacher class --- target/classes/Teacher.class | Bin 0 -> 1123 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 target/classes/Teacher.class diff --git a/target/classes/Teacher.class b/target/classes/Teacher.class new file mode 100644 index 0000000000000000000000000000000000000000..5f61a0c63e1ab4480ea52203bdea91d7da8d9b93 GIT binary patch literal 1123 zcmZuwT~8B16g|_HZo5tkEU<#26cA_^rG9?|LqbFol8O(7CO(iUU#iMbN3g zYVS%{G31|mfu~j&vejD4L;*zuCdVakhH?z=DbKHOZLO~{n2`v!!)|i0s9oo59$W!rhS(Ls2E!`Zj}=bU4p5i8szM zfh$DXmuf?FCBsIJhGfiK$EUYZDD965K?Y zp4|vI#!*6@ZYxxVir_ZxP}G@j%HmA7%}{<9Luu1GMg8A^^A*FNDak-L(362cx*$&g zX+eg2eaTb*lSliK=><|bEq8@lX?ya{;vuHawCS%8q-KC7*X`{Db*d+y>S4H#2WhQ3 zVNO)cd?M0$6_b4jq34~F-;j;kGJB!?;Uh{vF#p=B9>e+NEF5A+50;HRvEuDi$eU?$ dV3u||cWyxYbU<5w3{?AJ%w*c>NAXCH{{pJZxGMkv literal 0 HcmV?d00001 From da605c9f927b1b397c3ec654216f84f2a47d8f94 Mon Sep 17 00:00:00 2001 From: jtiradohernandez Date: Sat, 24 Feb 2024 11:39:10 +0100 Subject: [PATCH 08/22] Commands class created --- src/main/java/Commands.java | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/main/java/Commands.java diff --git a/src/main/java/Commands.java b/src/main/java/Commands.java new file mode 100644 index 0000000..85b69bd --- /dev/null +++ b/src/main/java/Commands.java @@ -0,0 +1,73 @@ +public class Commands { + private Course[] courseList; + private Student[] studentList; + private Teacher[] teacherList; + + public Commands(Course[] courseList, Student[] studentList, Teacher[] teacherList) { + setCourseList(courseList); + setStudentList(studentList); + setTeacherList(teacherList); + } + + public Course[] getCourseList() { + return courseList; + } + + public void setCourseList(Course[] courseList) { + this.courseList = courseList; + } + + public Student[] getStudentList() { + return studentList; + } + + public void setStudentList(Student[] studentList) { + this.studentList = studentList; + } + + public Teacher[] getTeacherList() { + return teacherList; + } + + public void setTeacherList(Teacher[] teacherList) { + this.teacherList = teacherList; + } + + public void enroll(String studentID, String courseID){ // This command will help enroll the student specified in the corresponding course. While also updating the money_earned of that course based on its price + int length = getCourseList().length; + + } + + public void assign(String teacherID,String courseID){ //This command will help assign the teacher specified to the corresponding course + + } + + public void ShowCourses(){ //This command will display a list of all courses + + } + + public void LookupCourse(String courseID){ // This command will display the full details of the specified course + + } + + public void ShowStudents(){ //This command will display a list of all students + + } + + public void LookupStudent(String studentID){ //This command will display the full details of the specified student + + } + + public void ShowTeachers(){ //This command will display a list of all teachers + + } + + public void LookupTeacher(String teacherID){ // This command will display the full details of the specified teacher + + } + + 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 + + } +} + From 2bbf9195be2ff45ae0385e3777ccb4410a6ec0b3 Mon Sep 17 00:00:00 2001 From: Xavi Soria Date: Sat, 24 Feb 2024 11:49:13 +0100 Subject: [PATCH 09/22] save commit after merge to this branch --- src/main/java/Application.java | 45 +++++++++++++++++++++++++++++++ target/classes/Application.class | Bin 0 -> 1970 bytes target/classes/Course.class | Bin 0 -> 1579 bytes target/classes/Student.class | Bin 0 -> 1515 bytes target/classes/Teacher.class | Bin 1123 -> 1036 bytes 5 files changed, 45 insertions(+) create mode 100644 src/main/java/Application.java create mode 100644 target/classes/Application.class create mode 100644 target/classes/Course.class create mode 100644 target/classes/Student.class diff --git a/src/main/java/Application.java b/src/main/java/Application.java new file mode 100644 index 0000000..25fcab8 --- /dev/null +++ b/src/main/java/Application.java @@ -0,0 +1,45 @@ +import java.util.Scanner; + +public class Application { + + public static void main(String[] args) { + + createSchoolName(); + numberOfTeachers(); + + + } + 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 numberOfTeachers() { + + int numberofTeachers; + do { + System.out.println("How many teachers are there in the school: "); + while (!scanner.hasNextInt()) { + System.out.println("Please enter a valid number for the teachers."); + scanner.next(); + } + numberofTeachers = scanner.nextInt(); + } while (numberofTeachers <= 0); + + + System.out.println("In your school there are: " + numberofTeachers + " teachers"); + return numberofTeachers; + + + } + +} + + + + diff --git a/target/classes/Application.class b/target/classes/Application.class new file mode 100644 index 0000000000000000000000000000000000000000..2b7388c4054ff4c94d9a5a2abb396ab30e961946 GIT binary patch literal 1970 zcmaJ?TT>iG6#kmq49jrIl7(cG;1CyFh+(~7SiB^w$eQJ%iy(QK5cda z!Ih{x4Jo}9-W1w<(83UgY0+;tw?(kJyDqrX5J4CPtoGv)vIa&iTt@C3e*G|1qDfw| zO)PS?h?y%(Yk}*lx+17%*~B=*twrU7F#HIQgPABX+**>~*-h>r+A29Jn+H@~Iy7OsemYZI zC-AC;*YG++roqD%B3t$8yhtqfO}xo)`&`AieZW0;$BxBd@5;D{CqQ#L-rE-5(beeD znQOzmg|e2Ap$!y03x@Y}$|TBMvD%?1T2&ufr0=^7U9LXTI9HNS)o-;=H-^4LywZ#1$PlSb< zl>6;g`C@5OmUA1|4_l&xd%FDb3s_F;D+y8Io>zC3pmVjV`g&J99)=<`u){EQA*W7M z4eT;Z{J$$bzHwfdq$j0|ZaPC=zbiEAr7=C()GpGjL_O2i*{5KSY0!mFsMX6rHhvr&GXc2Kl2%kXRtQU_7Blsz@XNob|4kU#4=WBEu%jKNt}m-s^b)n zFp?d6f-Ab8hXgqcar_LQlYgE5y%fR7)5i7FGE7HB1BQOb)YcI`c#6tz nuyw*Lbto2jeL=P^Y+#f6AsT%}9$!Z7eQc90LvsfLd${^9924Hr literal 0 HcmV?d00001 diff --git a/target/classes/Course.class b/target/classes/Course.class new file mode 100644 index 0000000000000000000000000000000000000000..8d886e05d50a2f5a6756f5fefe56e0853bfd0ede GIT binary patch literal 1579 zcmZ{kZBNr+6o&7@y0WcoFkS={1r*uJ%LGA%;e25+A(?2x%U4sj21>Thlw#sH|B;%= zG=A_0_@j*XY0Fqf_odI%bIxnt@;g1li8a+O5{Tw3lbS~*q#{jIt(l-P(KE}DP^%P>sS%1-stE`9FKIY zVvP!UmRUWuTm^~BL9i_<$VVu9lcP-aNU+naQOiulcC5XN#93TJYYLPckNI5Z+ZXgh z<2q&hgkmhVpczXo3>x_shKvcdh0*W+*$s(7oXK9UrcdZuXI_bV zif3G9Cq#)k*M8wv3)A1Y?Sqt#`{psfj2?u9WvB9F;x~7(D5Lu4H^$Y6>POp3d|`es__H!-5}E)AZi}fv{H~xvwPZRAfF9gny0jaEVfj*l}aw61i@WJVA^eATlNa zc^(O})D5y63Bq4g6v$FH$SOhBdVt6+5s(sIgtbfL`kW=iGw)C(pSB~7*)pq$hV z6tS%1j)@hlYM4+&J>P9s&d*O?YcM*tS8un1OJR_A=s-z|STk`?P%?fyC_{)hOl;yl z6{)p*oi3}*RFBo^K*N6NU%daZlrN~=al6iJlU3JqPJ69Or}N&vY$`R|HM@CXcU-xL z#-#tj?Xuo#s16@D8;(DsmCoy_YKPt(oMvPAhk8rDgBc+Aoo z6is((HxwXCpTURm(!j2sIHO24=dCLxnIY$%bOmcvHNinlab*{IO2}ZTodctG4vE?+ zJ@;{NVz9-v#M>wOC%G?M-=JCBedyLsA31BckGy4FW4e#|FDkmsbqQ&%8AfFJXJCTa zrkTBn94vmZf?U|f4sXn=STuDK8X;Ylp~V>A-^E-=QQ(t)#mV zO8zMT3lw@$Wta=RhQg#nVKmYY>KFydML~+OAdlifa#4^Kf~?*GB7G47AIE~^qabUs zAWz~!@==ftf^6ObB4Z&SPw|Yabaqsc^(e?zEXZ@b2!sD>&3Y8XBFOeFAo4pAkbNQ~ G@bV9j*x1Ve literal 0 HcmV?d00001 diff --git a/target/classes/Teacher.class b/target/classes/Teacher.class index 5f61a0c63e1ab4480ea52203bdea91d7da8d9b93..6f5d736f4ee04b161be3e56cb80a2f31e2aca031 100644 GIT binary patch delta 481 zcmZutJ5Iwu6r6`+V@wh!fE-K!~PK*Jew0XjDnNVz~Hh?E#a!2vh| zE%!jouB|9Vn%&v==FOX(U-!xNzW+YI09@m8>NQ2~)4s&%Sbj!*2qJbKV4=i&PrXCb z2i7xG=BTSdhK7nWG;gNtt|8_bz~;F@zK1F{v5hi9RB+5{i#k++!hp9%ZSuvSBlM^s zI6q$0sQO delta 569 zcmZvYy-or_6ot=#{I~)E)I~tdf(p2(>%Ul1SlE~t6B8?4$%bIo#gLU~#S7TcSojV~ zB49Mp-bb)9@jZ-pW(iu*%+H;3&;91y`oI0s$Ir_ffD(4vQj)QwR+i-te8@3m&h>__ znYvZc_Ds{L=w_*2xwt*seAV30V{Z z@F3CJXP?bQFf7rm3fvf>J+Ah^)Mxm*2zC%r3thz2d>6?!J-V<=t4z(nD9I&+Fotmi zFohsAsw!kdCRo8L?fjG`Jrk!n%##Dd8p8dd8j4IjdekRG9!cd)@QPwsI0hU+-;rV6 z>27_w~b~a;-%EAXX1?aavj2y#rcrpO#?*o4k`WnqUSvV&;Jg z{}HE$j!j{v-+V$L@j&F Date: Sat, 24 Feb 2024 12:41:38 +0100 Subject: [PATCH 10/22] minor changes student --- src/main/java/Student.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/java/Student.java b/src/main/java/Student.java index 4153e47..afd31bc 100644 --- a/src/main/java/Student.java +++ b/src/main/java/Student.java @@ -1,43 +1,51 @@ import java.util.UUID; + public class Student { - private String studentId; + 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.name = name; this.address = address; this.email = email; - this.studentId = generateStudentId(); + this.studentId = UUID.randomUUID().toString(); } + public String getStudentId() { return studentId; } - public String generateStudentId() { - return UUID.randomUUID().toString(); - } + 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; } From f04c24f91c54e6a2b6f607f9610e7019f5b408ac Mon Sep 17 00:00:00 2001 From: jtiradohernandez Date: Sat, 24 Feb 2024 13:30:24 +0100 Subject: [PATCH 11/22] Change from arrays to maps in Command class --- src/main/java/Commands.java | 65 ++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 12 deletions(-) diff --git a/src/main/java/Commands.java b/src/main/java/Commands.java index 85b69bd..fbca649 100644 --- a/src/main/java/Commands.java +++ b/src/main/java/Commands.java @@ -1,41 +1,82 @@ +import java.util.HashMap; +import java.util.Map; + public class Commands { - private Course[] courseList; - private Student[] studentList; - private Teacher[] teacherList; + private Map courseList = new HashMap<>(); + private Map studentList = new HashMap<>(); + private Map teacherList = new HashMap<>(); + - public Commands(Course[] courseList, Student[] studentList, Teacher[] teacherList) { + public Commands(Map courseList, Map studentList, Map teacherList) { setCourseList(courseList); setStudentList(studentList); setTeacherList(teacherList); } - public Course[] getCourseList() { + public Map getCourseList() { return courseList; } - public void setCourseList(Course[] courseList) { + public void setCourseList(Map courseList) { this.courseList = courseList; } - public Student[] getStudentList() { + public Map getStudentList() { return studentList; } - public void setStudentList(Student[] studentList) { + public void setStudentList(Map studentList) { this.studentList = studentList; } - public Teacher[] getTeacherList() { + public Map getTeacherList() { return teacherList; } - public void setTeacherList(Teacher[] teacherList) { + public void setTeacherList(Map teacherList) { this.teacherList = teacherList; } - public void enroll(String studentID, String courseID){ // This command will help enroll the student specified in the corresponding course. While also updating the money_earned of that course based on its price - int length = getCourseList().length; + 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(String studentID, String courseID){ // This command will help enroll the student specified in the corresponding course. While also updating the money_earned of that course based on its price } public void assign(String teacherID,String courseID){ //This command will help assign the teacher specified to the corresponding course From 3a00d3dcaad8d69aa16ec43f03a468e968b8260c Mon Sep 17 00:00:00 2001 From: Xavi Soria Date: Sat, 24 Feb 2024 15:14:24 +0100 Subject: [PATCH 12/22] save commit after merge to this branch --- .gitignore | 4 +++ .idea/codeStyles/Project.xml | 7 +++++ .idea/codeStyles/codeStyleConfig.xml | 5 ++++ .idea/compiler.xml | 13 +++++++++ .idea/encodings.xml | 7 +++++ .idea/jarRepositories.xml | 20 ++++++++++++++ .idea/misc.xml | 1 + .idea/modules.xml | 8 ------ src/main/java/Application.java | 39 ++++++++++++++++++++++++--- src/main/java/Commands.java | 4 +-- target/classes/Application.class | Bin 1970 -> 3702 bytes target/classes/Commands.class | Bin 0 -> 2737 bytes target/classes/Student.class | Bin 1515 -> 1424 bytes 13 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/jarRepositories.xml delete mode 100644 .idea/modules.xml create mode 100644 target/classes/Commands.class 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/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/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 index fdc35ea..de4b033 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -7,6 +7,7 @@ +