From 2542ae7b9dadcc0e02d9714aafa572f540c4e234 Mon Sep 17 00:00:00 2001 From: fdai7921 Date: Wed, 7 Feb 2024 13:21:26 +0100 Subject: [PATCH] Adding addCourse method in Course class --- src/main/java/org/example/Course.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/Course.java b/src/main/java/org/example/Course.java index ff8a721..9092951 100644 --- a/src/main/java/org/example/Course.java +++ b/src/main/java/org/example/Course.java @@ -146,5 +146,9 @@ public class Course { return courses; } - + public static void addCourse(String courseName, String courseCode, int courseCredit, String filename) { + // Write course data to the file + Course course = new Course(); + course.writeToFile(courseName, courseCode, courseCredit, filename); + } }