Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team finished Homework 2 #22

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
670850a
recreate ironschool homework
NomadRiding Jun 25, 2024
a8ecb8a
add test
NomadRiding Jun 25, 2024
c91b837
resubmiting Teacher
estefanymary Jun 25, 2024
caa496b
Merge pull request #1 from NomadRiding/Teacher
NomadRiding Jun 25, 2024
e7b78de
Add jdk file, add welcome method
NomadRiding Jun 26, 2024
88db8db
import scanner
NomadRiding Jun 26, 2024
532232d
save school name
NomadRiding Jun 26, 2024
da95d3e
create profanity checker
NomadRiding Jun 26, 2024
aaa96ad
add number checker
NomadRiding Jun 26, 2024
d343008
implement checkers on schoolName
NomadRiding Jun 26, 2024
8f1e0be
create teacher quantity and teacher name
NomadRiding Jun 26, 2024
5db16a8
add course Names
NomadRiding Jun 26, 2024
ca4136c
clean profanity checker for excess code
NomadRiding Jun 26, 2024
d296262
add command menu with switch case statement
NomadRiding Jun 26, 2024
9aeb280
create course class, with getters and setters
NomadRiding Jun 26, 2024
346532e
refactor and add Teacher
NomadRiding Jun 26, 2024
ad440fc
add courseId autogenerate
NomadRiding Jun 26, 2024
40a174a
create course cost
NomadRiding Jun 26, 2024
025b8ad
create course and teacher method for menu
NomadRiding Jun 26, 2024
25c1fff
total teacher salary and profit
NomadRiding Jun 26, 2024
09c41e7
add profit logic
NomadRiding Jun 26, 2024
fb10919
student class
axgracia Jun 26, 2024
2eae84a
add course
NomadRiding Jun 26, 2024
10a469f
create generate studentid method
axgracia Jun 27, 2024
425e9d7
Merge branch 'main' into student
NomadRiding Jun 27, 2024
2327e54
Merge pull request #2 from NomadRiding/student
NomadRiding Jun 27, 2024
434d95c
add student method show student and look up student
axgracia Jun 27, 2024
e6c571e
Merge pull request #3 from NomadRiding/student
NomadRiding Jun 27, 2024
daab9a7
add lookup course, student quantity and student info
NomadRiding Jun 27, 2024
32751ce
add enrollment
NomadRiding Jun 27, 2024
0ce3fd0
add assign Teacher
NomadRiding Jun 27, 2024
de19ac5
create test for logic, verify student, teacher and course
NomadRiding Jun 27, 2024
39781c7
Merge pull request #4 from NomadRiding/testing
NomadRiding Jun 27, 2024
0d2c081
beautify code
NomadRiding Jun 27, 2024
57426eb
Merge pull request #5 from NomadRiding/testing
NomadRiding Jun 27, 2024
65447d8
create teacher lookup
estefanymary Jun 27, 2024
57c161a
Merge pull request #6 from NomadRiding/Teacher2
NomadRiding Jun 27, 2024
463359d
add assign
NomadRiding Jun 27, 2024
f3de818
Merge pull request #7 from NomadRiding/assign
NomadRiding Jun 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/homework-java-ironschool.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added ironSchool/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions ironSchool/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions ironSchool/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ironSchool/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions ironSchool/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions ironSchool/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ironSchool/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions ironSchool/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>ironSchool</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Binary file added ironSchool/src/.DS_Store
Binary file not shown.
Binary file added ironSchool/src/main/.DS_Store
Binary file not shown.
Binary file added ironSchool/src/main/java/.DS_Store
Binary file not shown.
Binary file added ironSchool/src/main/java/org/.DS_Store
Binary file not shown.
73 changes: 73 additions & 0 deletions ironSchool/src/main/java/org/example/Course.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package org.example;

public class Course {
private static int courseCounter = 0;
private String courseId;
private String name;
private double price;
private double money_earned;
private Teacher teacher;

public String getCourseId() {
return courseId;
}

public void setCourseId(String courseId) {
this.courseId = courseId;
}

public Course(String name, double price) {
this.courseId = generateCourseId();
this.name = name;
this.price = 1500;
this.money_earned = 0.0;
}

private static synchronized String generateCourseId() {
return "COURSE-" + (courseCounter++);
}

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 Teacher getTeacher(){
return teacher;
}

public void setTeacher(Teacher teacher){
this.teacher = teacher;
}

public double getMoney_earned() {
return money_earned;
}


public void addEarnings(double earnings){
if (earnings > 0){
this.money_earned += earnings;
}
}

@Override
public String toString() {

return "Course Name: " + name + "\n" +
"Course ID: " + courseId + "\n" +
"price: " + price + "\n" +
"money_earned: " + money_earned + "\n";
}
}
7 changes: 7 additions & 0 deletions ironSchool/src/main/java/org/example/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.example;

public class Main {
public static void main(String[] args) {

}
}
88 changes: 88 additions & 0 deletions ironSchool/src/main/java/org/example/Student.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package org.example;
import java.util.List;
import java.util.UUID;

public class Student {

private String studentId;
private String name;
private String address;
private String email;
private Course course;
private List<Course> coursesEnrolled;



// Parameterized constructor
public Student(String name, String address, String email) {
this.studentId = generateStudentId();
this.name = name;
this.address = address;
this.email = email;
}

public String generateStudentId() {
return UUID.randomUUID().toString();

}

// Getter for studentId
public String getStudentId() {
return studentId;
}

// Getter and Setter for name
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

// Getter and Setter for address
public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

// Getter and Setter for email
public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

//Getter and Setter for course
public Course getCourse() {
return course;
}

public void setCourse(Course course) {
this.course = course;
}


@Override
public String toString() {
StringBuilder details = new StringBuilder();
details.append("Student Name: ").append(name).append("\n")
.append("Student ID: ").append(studentId).append("\n")
.append("Address: ").append(address).append("\n")
.append("Email: ").append(email).append("\n");
details.append("Enrolled Courses: ").append(coursesEnrolled.size() > 0 ? "\n" : "None\n");

for (Course course : coursesEnrolled) {
details.append(course.getName()).append("\n");
}
return details.toString();
}


}

Loading