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

ironhack #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Empty file added .gitignore
Empty file.
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.

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.

14 changes: 14 additions & 0 deletions .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 .idea/vcs.xml

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

90 changes: 90 additions & 0 deletions .idea/workspace.xml

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

30 changes: 30 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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>

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>


</project>




64 changes: 64 additions & 0 deletions src/main/java/School/Course.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

22 changes: 22 additions & 0 deletions src/main/java/School/Main.java
Original file line number Diff line number Diff line change
@@ -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", "[email protected]");

// 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
*/
}
68 changes: 68 additions & 0 deletions src/main/java/School/Student.java
Original file line number Diff line number Diff line change
@@ -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;
}
}


44 changes: 44 additions & 0 deletions src/main/java/School/Teacher.java
Original file line number Diff line number Diff line change
@@ -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;
}
}