From 955d2488075eab12484a2c190e19f7a12519f7cd Mon Sep 17 00:00:00 2001 From: Shanice Bandoo Date: Sat, 29 Jun 2024 00:43:11 -0400 Subject: [PATCH] Final changes --- .idea/.gitignore | 3 + .idea/homework-java-ironschool.iml | 11 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 + Course.java | 54 +++++++++ SchoolManagementSystem.java | 67 +++++++++++ Student.java | 53 +++++++++ Teacher.java | 33 ++++++ .../homework-java-ironschool/.idea/.gitignore | 3 + .../.idea/homework-java-ironschool.iml | 11 ++ .../homework-java-ironschool/.idea/misc.xml | 6 + .../.idea/modules.xml | 8 ++ .../homework-java-ironschool/.idea/vcs.xml | 6 + .../homework-java-ironschool/Course.class | Bin 0 -> 1432 bytes .../homework-java-ironschool/README.md | 108 ++++++++++++++++++ .../SchoolManagementSystem.class | Bin 0 -> 2675 bytes .../homework-java-ironschool/Student.class | Bin 0 -> 1433 bytes .../homework-java-ironschool/Teacher.class | Bin 0 -> 973 bytes 19 files changed, 383 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 Course.java create mode 100644 SchoolManagementSystem.java create mode 100644 Student.java create mode 100644 Teacher.java create mode 100644 out/production/homework-java-ironschool/.idea/.gitignore create mode 100644 out/production/homework-java-ironschool/.idea/homework-java-ironschool.iml create mode 100644 out/production/homework-java-ironschool/.idea/misc.xml create mode 100644 out/production/homework-java-ironschool/.idea/modules.xml create mode 100644 out/production/homework-java-ironschool/.idea/vcs.xml create mode 100644 out/production/homework-java-ironschool/Course.class create mode 100644 out/production/homework-java-ironschool/README.md create mode 100644 out/production/homework-java-ironschool/SchoolManagementSystem.class create mode 100644 out/production/homework-java-ironschool/Student.class create mode 100644 out/production/homework-java-ironschool/Teacher.class 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..b107a2d --- /dev/null +++ b/.idea/homework-java-ironschool.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ 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..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/Course.java b/Course.java new file mode 100644 index 0000000..c5d00e0 --- /dev/null +++ b/Course.java @@ -0,0 +1,54 @@ +import java.util.UUID; + +public class Course { + private String courseId; + private String name; + private double price; + private double moneyEarned; + private Teacher teacher; + + public Course(String name, double price) { + this.courseId = UUID.randomUUID().toString(); + this.name = name; + this.price = price; + this.moneyEarned = 0.0; + this.teacher = null; + } + + public String getCourseId() { + return 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 getMoneyEarned() { + return moneyEarned; + } + + public void addMoneyEarned(double amount) { + this.moneyEarned += amount; + } + + public Teacher getTeacher() { + return teacher; + } + + public void setTeacher(Teacher teacher) { + this.teacher = teacher; + } +} + diff --git a/SchoolManagementSystem.java b/SchoolManagementSystem.java new file mode 100644 index 0000000..df5513f --- /dev/null +++ b/SchoolManagementSystem.java @@ -0,0 +1,67 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class SchoolManagementSystem { + private String schoolName; + private List teachers; + private List courses; + private List students; + + public SchoolManagementSystem() { + this.teachers = new ArrayList<>(); + this.courses = new ArrayList<>(); + this.students = new ArrayList<>(); + } + + public void start() { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter school name: "); + schoolName = scanner.nextLine(); + + System.out.print("Enter the number of teachers to create: "); + int numTeachers = Integer.parseInt(scanner.nextLine()); + + for (int i = 0; i < numTeachers; i++) { + System.out.print("Enter teacher name: "); + String teacherName = scanner.nextLine(); + System.out.print("Enter teacher salary: "); + double teacherSalary = Double.parseDouble(scanner.nextLine()); + teachers.add(new Teacher(teacherName, teacherSalary)); + } + + System.out.print("Enter the number of courses to create: "); + int numCourses = Integer.parseInt(scanner.nextLine()); + + for (int i = 0; i < numCourses; i++) { + System.out.print("Enter course name: "); + String courseName = scanner.nextLine(); + System.out.print("Enter course price: "); + double coursePrice = Double.parseDouble(scanner.nextLine()); + courses.add(new Course(courseName, coursePrice)); + } + + System.out.print("Enter the number of students to create: "); + int numStudents = Integer.parseInt(scanner.nextLine()); + + for (int i = 0; i < numStudents; i++) { + System.out.print("Enter student name: "); + String studentName = scanner.nextLine(); + System.out.print("Enter student address: "); + String studentAddress = scanner.nextLine(); + System.out.print("Enter student email: "); + String studentEmail = scanner.nextLine(); + students.add(new Student(studentName, studentAddress, studentEmail)); + } + + // Add commands to handle user interaction here + + scanner.close(); + } + + public static void main(String[] args) { + SchoolManagementSystem sms = new SchoolManagementSystem(); + sms.start(); + } +} \ No newline at end of file diff --git a/Student.java b/Student.java new file mode 100644 index 0000000..df93902 --- /dev/null +++ b/Student.java @@ -0,0 +1,53 @@ +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.studentId = UUID.randomUUID().toString(); + this.name = name; + this.address = address; + this.email = email; + this.course = null; + } + + 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; + } +} diff --git a/Teacher.java b/Teacher.java new file mode 100644 index 0000000..03d49e6 --- /dev/null +++ b/Teacher.java @@ -0,0 +1,33 @@ +import java.util.UUID; + +public class Teacher { + private String teacherId; + private String name; + private double salary; + + public Teacher(String name, double salary) { + this.teacherId = UUID.randomUUID().toString(); + this.name = name; + this.salary = 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) { + this.salary = salary; + } +} diff --git a/out/production/homework-java-ironschool/.idea/.gitignore b/out/production/homework-java-ironschool/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/out/production/homework-java-ironschool/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/out/production/homework-java-ironschool/.idea/homework-java-ironschool.iml b/out/production/homework-java-ironschool/.idea/homework-java-ironschool.iml new file mode 100644 index 0000000..b107a2d --- /dev/null +++ b/out/production/homework-java-ironschool/.idea/homework-java-ironschool.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/out/production/homework-java-ironschool/.idea/misc.xml b/out/production/homework-java-ironschool/.idea/misc.xml new file mode 100644 index 0000000..e6be3f1 --- /dev/null +++ b/out/production/homework-java-ironschool/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/homework-java-ironschool/.idea/modules.xml b/out/production/homework-java-ironschool/.idea/modules.xml new file mode 100644 index 0000000..7d98804 --- /dev/null +++ b/out/production/homework-java-ironschool/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/out/production/homework-java-ironschool/.idea/vcs.xml b/out/production/homework-java-ironschool/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/out/production/homework-java-ironschool/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/out/production/homework-java-ironschool/Course.class b/out/production/homework-java-ironschool/Course.class new file mode 100644 index 0000000000000000000000000000000000000000..80f92dfb569a99643483448a81586be90cdf872d GIT binary patch literal 1432 zcmZ`(*>2N76g`v0No_Z6)0OTUBymdvw5%z-v>;Uq1*wa~qnlW*tHeRBgVe7Aqy`WV zd;lMXI5T$LG=!JAckbNfoO_)7{`2z}fS1_Tkw7wol!-Jnf#GxelU;7u-f8*W$+=St z1hj3}bAwj`$zthPM-~Ga=q3!90y&l54%|lh=xA?OK=*C0-fD)Ie6du$olueWITJ$| z7RUyzgTQyaQ-QJTOf@--RtAvAXa-{@#xX%0JFT{V;jpfzoV~h0KJ4FHHD%(CEJ=BG z(~)gvOw3|VApOyIYiuEQWpu&BqKq2Nmgii)wtdg3%lNX16|4$m0>`eMIljO^^)PfR z0u#l5hwhe+Ic=v^XYZk^>pA=F=85AU+9wT0^3_(&ZXDabEALS-6`Z*jBvTD(v9WRL z1mQ(e%kZ{O`1CHWz41Py<>V}L--pa75@pD;BnqU83S5pUZ*OQ)I=f!K70~QvtL;&6 zov9IBf}%1v+;#SipUh(XB0=Z}l%?jpaV2FVB(fpp#}ap%;OCa+Nh#?iq&~`07G)`f zvRpi^4r+zFJn!*#i6m0AE7o@i>jyI5FxbI}wbsF;RqSBe%5^Yri4K;&swM@V^T_bj zS!f^!6QdZ!6umiqe9IU{k*|wv%(f`OqLrS6C6p(DCFrj)H-u59m2YY53L{_WBp?TA zDmbbdnqflJP++}p@nmoDWZ&ZZ*kC)kfL9zP7pN)9Hyq`U7ntFyW>trYFe~PxMSKLx zco6j}Gv}Jc^kG}pk XeKv`8s|$!01JUIFj9SYJB}C;f*}u*K literal 0 HcmV?d00001 diff --git a/out/production/homework-java-ironschool/README.md b/out/production/homework-java-ironschool/README.md new file mode 100644 index 0000000..1d3c661 --- /dev/null +++ b/out/production/homework-java-ironschool/README.md @@ -0,0 +1,108 @@ +![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png) + +# HW | Java IronSchool (Unit 2 homework) + +## Introduction + +For this homework, you will be building a School Management System, that will help manage students, teachers and courses with some basic functionalities. + +## Instructions + +Let's walk through the details of the homework: + +### Classes + +Three main classes are necessary to complete this homework: **Teacher**, **Student** and **Course**. + +
+ +**Teacher class** + +This class will have: + +- Variable called `teacherId` of data type `string`, auto-generated (Private member) +- Variable called `name` of data type `string` (Private member) +- Variable called `salary` of data type `double`, representing the salary of the teacher (Private member) +- A parameterized constructor that takes `name` and `salary` +- Public Getter functions to access these variables +- Public Setter functions to change these variables +- Optional attributes are accepted if needed based on the code structure + +
+ +**Course class** + +This class will have: + +- Variable called `courseId` of data type `string`, auto-generated (Private member) +- Variable called `name` of data type `string` (Private member) +- Variable called `price` of data type `double`, representing the price of this course (Private member) +- Variable called `money_earned` of data type `double`, representing the total money earned by this course (Private member) +- Nullable variable called `teacher` of data type `Teacher` (Private member) +- A parameterized constructor that takes `name` and `price` +- Public Getter functions to access these variables +- Public Setter functions to change these variables +- Optional attributes are accepted if needed based on the code structure + +
+ +**Student class** + +This class will have: + +- Variable called `studentId` of data type `string`, auto-generated (Private member) +- Variable called `name` of data type `string` (Private member) +- Variable called `address` of data type `string` (Private member) +- Variable called `email` of data type `string` (Private member) +- Nullable variable called `course` of data type `Course`, representing the course this student is enrolled into (Private member) +- A parameterized constructor that takes `name`, `address` and `email` +- Public Getter functions to access these variables +- Public Setter functions to change these variables +- Optional attributes are accepted if needed based on the code structure + +## How the application works + +1. The application starts by asking the user for a name for the school +2. Next, the user is asked for a number of how many teachers should be created +3. Next, the user is prompted to enter the details of each teacher (based on the number chosen above) +4. Next, the user is asked for the number of courses to be created (Do not specify the teacher yet, there is a command for it) +5. Next, the user is prompted to enter details of each course based on the number chosen above +6. Next, the user is asked for the number of students to be created (Do not specify the course yet, there is a command for it) +7. Next, the user is prompted to enter details of each student based on the number chosen above +8. Next, the user is now prompted to enter any command of the list below to execute a specified action in the system. + +The IDs should be automatically generated. + +## Commands + +- **ENROLL** **[STUDENT_ID] [COURSE_ID]**: 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 +- **ASSIGN** **[TEACHER_ID] [COURSE_ID]**: This command will help assign the teacher specified to the corresponding course +- **SHOW COURSES**: This command will display a list of all courses +- **LOOKUP COURSE** **[COURSE_ID]**: This command will display the full details of the specified course +- **SHOW STUDENTS**: This command will display a list of all students +- **LOOKUP STUDENT** **[STUDENT_ID]**: This command will display the full details of the specified student +- **SHOW TEACHERS**: This command will display a list of all teachers +- **LOOKUP TEACHER** **[TEACHER_ID]**: This command will display the full details of the specified teacher +- **SHOW PROFIT**: This command will calculate **(The total money earned from all courses)** - **(The sum of all the teachers' salaries)** and return the result + +## Requirements + +For this project you must accomplish all of the following: + +1. Navigate through a text-based menu using Standard Input and Output. +2. Create unit tests for every method other than basic getters, setters and constructors (getters and setters with logic do require unit tests). +3. Handle all exceptions gracefully (incorrect input should not crash the program). +4. Create Teachers, Courses and Students specifying their full details. +5. Handle receiving commands in the Standard Input that corresponds to actual actions in the system. + +### Bonus + +1. Add more commands that can help display more information such as (**SHOW STUDENTS** **[COURSE_ID]**, **SHOW MONEY EARNED**, **SHOW MONEY SPENT**, etc.) + +## Important Notes + +- Everyone in the squad should contribute equally to the project in time and lines of code written. +- All code must be reviewed before it is merged into the `master` branch. +- All squad members must participate in code review. +- Every repository should have a README file with clear instructions, demo files, or any documentation needed so other teams don't have problems with the review. +- This is intended to be a challenging assignment. You will have to rely heavily on your teammates and independent research. Learning independently is a hallmark of a good developer and our job is to turn you into good developers. This process may be frustrating but you will learn a ton! \ No newline at end of file diff --git a/out/production/homework-java-ironschool/SchoolManagementSystem.class b/out/production/homework-java-ironschool/SchoolManagementSystem.class new file mode 100644 index 0000000000000000000000000000000000000000..c9f28c62c8f97a86fb2c0bf320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