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

Final changes #30

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
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.

11 changes: 11 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.

6 changes: 6 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.

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

67 changes: 67 additions & 0 deletions SchoolManagementSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class SchoolManagementSystem {
private String schoolName;
private List<Teacher> teachers;
private List<Course> courses;
private List<Student> 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();
}
}
53 changes: 53 additions & 0 deletions Student.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
33 changes: 33 additions & 0 deletions Teacher.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
3 changes: 3 additions & 0 deletions out/production/homework-java-ironschool/.idea/.gitignore

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

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

6 changes: 6 additions & 0 deletions out/production/homework-java-ironschool/.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 out/production/homework-java-ironschool/.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 out/production/homework-java-ironschool/.idea/vcs.xml

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

Binary file not shown.
Loading