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

Merge Branch-Ethan-9-Oct into Master #17

Merged
Merged
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test {
}

application {
mainClass.set("seedu.duke.Duke")
mainClass.set("TutorLink.TutorLink")
}

shadowJar {
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/TutorLink/TutorLink.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package tutorlink;

import java.util.Scanner;

/**
* Represents the main class containing the entry point for the TutorLink application
*/
public class TutorLink {
/**
* Main entry-point for the java.duke.Duke application.
*/
public static void main(String[] args) {
String logo = "___________ __ .____ .__ __ \n"
+ "\\__ ___/_ ___/ |_ ___________| | |__| ____ | | __\n"
+ " | | | | \\ __\\/ _ \\_ __ \\ | | |/ \\| |/ /\n"
+ " | | | | /| | ( <_> ) | \\/ |___| | | \\ < \n"
+ " |____| |____/ |__| \\____/|__| |_______ \\__|___| /__|_ \\\n"
+ " \\/ \\/ \\/\n";
System.out.println("Hello from\n" + logo);
System.out.println("What is your name?");

Scanner in = new Scanner(System.in);
System.out.println("Hello " + in.nextLine());
}
}
33 changes: 33 additions & 0 deletions src/main/java/TutorLink/assignment/Assignment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package tutorlink.assignment;

import java.util.Objects;

public class Assignment {
private String assginmentDescription;
private double receivedScore;
private double totalScore;
private double weighting;

public Assignment(String assginmentDescription, double receivedScore, double totalScore, double weighting) {
this.assginmentDescription = assginmentDescription;
this.receivedScore = receivedScore;
this.totalScore = totalScore;
this.weighting = weighting;
}

public double getWeightedScore() {
return (receivedScore / totalScore) * weighting;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()){
return false;
}
Assignment that = (Assignment) obj;
return Objects.equals(assginmentDescription, that.assginmentDescription);
}
}
23 changes: 23 additions & 0 deletions src/main/java/TutorLink/attendance/Attendance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tutorlink.attendance;

public class Attendance {
private String attendanceVenue;
private String attendanceDateTime; //modify this to accept LocalDateTime
private boolean isPresent;

public Attendance(String attendanceVenue, String localDateTime, boolean isPresent){
this.attendanceVenue = attendanceVenue;
this.attendanceDateTime = localDateTime;
this.isPresent = isPresent;
}

public String getAttendanceDateTime() {
return attendanceDateTime;
}
public String getAttendanceVenue() {
return attendanceVenue;
}
public boolean getIsPresent() {
return isPresent;
}
}
21 changes: 21 additions & 0 deletions src/main/java/TutorLink/command/Command.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tutorlink.command;

import java.util.ArrayList;

/**
* Represents an interpreted Command from the user. A <code>Command</code> object corresponds to a
* single user-issued command from the terminal.
*/

public abstract class Command {
/**
* Executes the required operations to perform the command issued by the user.
*/
abstract public void execute(ArrayList list);
/**
* Checks if the command is an exit command.
*
* @return whether the current command is an ExitCommand
*/
abstract public boolean isExit();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tutorlink.command.assignment_command;

import tutorlink.assignment.Assignment;

import java.util.ArrayList;

public class AddAssignmentCommand extends AssignmentCommand {
public AddAssignmentCommand(Assignment assignment) {
super(assignment);
}

@Override
public void execute(ArrayList assignmentList) {

}

@Override
public boolean isExit() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package tutorlink.command.assignment_command;

import tutorlink.assignment.Assignment;
import tutorlink.command.Command;

import java.util.ArrayList;

public abstract class AssignmentCommand extends Command {
private Assignment assignment;

public AssignmentCommand(Assignment assignment) {
this.assignment = assignment;
}

public abstract void execute(ArrayList assignmentList);

public boolean isExit() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tutorlink.command.assignment_command;

import tutorlink.assignment.Assignment;

import java.util.ArrayList;

public class DeleteAssignmentCommand extends AssignmentCommand{
public DeleteAssignmentCommand(Assignment assignment) {
super(assignment);
}

public void execute(ArrayList assignmentList) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package tutorlink.command.attendance_command;

import tutorlink.attendance.Attendance;

import java.util.ArrayList;

public class AddAttendanceCommand extends AttendanceCommand{

public AddAttendanceCommand(Attendance attendance) {
super(attendance);
}

@Override
public void execute(ArrayList attendanceList) {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package tutorlink.command.attendance_command;

import tutorlink.attendance.Attendance;
import tutorlink.command.Command;

public abstract class AttendanceCommand extends Command {
private Attendance attendance;

public AttendanceCommand(Attendance attendance) {
this.attendance = attendance;
}

@Override
public boolean isExit() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package tutorlink.command.attendance_command;

import tutorlink.attendance.Attendance;

import java.util.ArrayList;

public class DeleteAttendanceCommand extends AttendanceCommand{

public DeleteAttendanceCommand(Attendance attendance) {
super(attendance);
}

@Override
public void execute(ArrayList list) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package tutorlink.command.student_command;

import tutorlink.student.Student;

import java.util.ArrayList;

public class DeleteStudentCommand extends StudentCommand{

public DeleteStudentCommand(Student student) {
super(student);
}
@Override
public void execute(ArrayList list) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tutorlink.command.student_command;

import tutorlink.command.Command;
import tutorlink.student.Student;

public abstract class StudentCommand extends Command {
private Student student;
public StudentCommand(Student student) {
this.student = student;
}
@Override
public boolean isExit() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package tutorlink.command.student_command;

import tutorlink.student.Student;

import java.util.ArrayList;

public class addStudentCommand extends StudentCommand{

public addStudentCommand(Student student) {
super(student);
}

@Override
public void execute(ArrayList list) {

}

}
29 changes: 29 additions & 0 deletions src/main/java/TutorLink/course/Course.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tutorlink.course;

import tutorlink.assignment.Assignment;
import tutorlink.list.AssignmentList;
import tutorlink.list.AttendanceList;

public class Course {
private String courseID;
private int courseMCs;
private LetterGrade grade;
AssignmentList assignments;
AttendanceList attendances;


public Course(String courseID, int courseMCs) {
this.courseID = courseID;
this.courseMCs = courseMCs;
assignments = new AssignmentList();
attendances = new AttendanceList();
}

public void addAssignment(Assignment assignment) {
assignments.addAssignment(assignment);
}

public void deleteAssignment(Assignment assignment) {
assignments.deleteAssignment(assignment);
}
}
29 changes: 29 additions & 0 deletions src/main/java/TutorLink/course/LetterGrade.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package tutorlink.course;

public enum LetterGrade {
A_plus,A,A_minus,
B_plus,B,B_minus,
C_plus,C,
D_plus,D,
F,
IP; //In-Progress, no grade available

public double getGPA(LetterGrade grade) {
double result = 0.0;
switch (grade) {
case A_plus -> result = 5.0;
case A -> result = 5.0;
case A_minus -> result = 4.5;
case B_plus -> result = 4.0;
case B -> result = 3.5;
case B_minus -> result = 3.0;
case C_plus -> result = 2.5;
case C -> result = 2.0;
case D_plus -> result = 1.5;
case D -> result = 1.0;
case F -> result = 0.0;
default -> result = -1.0; //IP case will be -1.0
}
return result;
}
}
24 changes: 24 additions & 0 deletions src/main/java/TutorLink/list/AssignmentList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package tutorlink.list;

import tutorlink.assignment.Assignment;

import java.util.ArrayList;
import java.util.Arrays;

public class AssignmentList {
private int numberOfAssignments;
ArrayList<Assignment> assignmentArrayList;

public AssignmentList() {
this.numberOfAssignments = 0;
this.assignmentArrayList = new ArrayList<>();
}

public void deleteAssignment(Assignment assignment){
assignmentArrayList.remove(assignment);
}

public void addAssignment(Assignment assignment){
assignmentArrayList.add(assignment);
}
}
23 changes: 23 additions & 0 deletions src/main/java/TutorLink/list/AttendanceList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package tutorlink.list;

import tutorlink.attendance.Attendance;

import java.util.ArrayList;

public class AttendanceList {
private ArrayList<Attendance> attendanceArrayList;
private int numberOfAttendance;

public AttendanceList() {
this.numberOfAttendance = 0;
this.attendanceArrayList = new ArrayList<>();
}

public void markAttendance(Attendance attendance){
this.attendanceArrayList.add(attendance);
}

public void unmarkAttendance(Attendance attendance){
this.attendanceArrayList.remove(attendance);
}
}
Loading
Loading