Added files

This commit is contained in:
2026-05-14 16:13:28 +03:00
parent 4f70214745
commit 527308b46f
34 changed files with 287 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}

BIN
assets/lesson1-01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
assets/lesson1-02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/lesson1-03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
assets/lesson1-04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
assets/lesson1-05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/lesson1-06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/lesson1-07.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/lesson1-08.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/lesson1-09.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
assets/lesson1-10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/lesson1-11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
assets/lesson1-12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
assets/lesson1-13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
assets/lesson1-14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
assets/lesson1-15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
assets/lesson1-16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
assets/lesson1-17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
assets/lesson1-18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

75
pom.xml Normal file
View File

@@ -0,0 +1,75 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.csase</groupId>
<artifactId>githubintro</artifactId>
<version>1.0</version>
<name>githubintro</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!--
https://projectlombok.org/
-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!--
https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests
-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<!-- remove spaces
<compilerArgs> - - enable-preview</compilerArgs>
-->
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>
</project>

BIN
src/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/main/.DS_Store vendored Normal file

Binary file not shown.

BIN
src/main/java/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,57 @@
package com.csase;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/*
* Represents an assignment with a name and due date
*/
public class Assignment {
private String name; // name of assignment
private LocalDate dueDate; // due date of assignment
/*
* Sets name and due date of assignment
*/
public Assignment(String name, LocalDate dueDate) {
this.name = name;
this.dueDate = dueDate;
}
/*
* Returns name of assignment
*/
public String getName() {
return this.name;
}
/*
* Returns due date of assignment
*/
public LocalDate getDueDate() {
return this.dueDate;
}
/*
* Sets name of assignment
*/
public void setName(String name) {
this.name = name;
}
/*
* Sets due date of assignment
*/
public void setDate(LocalDate dueDate) {
this.dueDate = dueDate;
}
/*
* Returns string representation of assignment
*/
public String toString() {
return this.name + " (due: " + this.dueDate.format(DateTimeFormatter.ofPattern("dd/MM/yyyy")) + ")";
}
}

View File

@@ -0,0 +1,9 @@
package com.csase;
public class DeleteMe {
public void deleteMe() {
System.out.println("Delete me!");
}
}

View File

@@ -0,0 +1,13 @@
package com.csase;
public class PlannerRunner {
public static void main(String[] args) {
// Create a new student
Student jada = new Student();
// Gets the student's choice until the student exits
jada.getChoice();
}
}

View File

@@ -0,0 +1,63 @@
package com.csase;
import java.util.Scanner;
/*
* Represents a student that with a study planner
*/
public class Student {
private StudyPlanner planner; // study planner
private Scanner scanner; // scanner for user input
/*
* Sets study planner and scanner
*/
public Student {
planner = new StudyPlanner();
scanner = new Scanner(System.in);
}
/*
* Gets the student's choice and runs it until the student exits
*/
public void getChoice() {
int option = -1;
while (option != 3) {
System.out.println("Welcome to Study Planner!");
System.out.println("What would you like to do?");
System.out.println(planner.getOptions());
System.out.print("Enter option: ");
option = scanner.nextInt();
scanner.nextLine();
runChoice(option);
}
}
/*
* Runs the student's choice
*/
public void runChoice(int option) {
if (option == 1) {
addAssignment();
} else if (option == 2) {
System.out.println(planner.listAssignments());
} else if (option == 3) {
System.out.println("Goodbye!");
} else {
System.out.println("Invalid option!");
}
}
/*
* Adds a new assignment to the study planner
*/
public void addAssignment() {
System.out.print("Enter assignment name: ");
String name = scanner.nextLine();
System.out.print("Enter due date (YYYY-MM-DD): ");
String dueDate = scanner.nextLine();
planner.addAssignment(name, dueDate);
}
}

View File

@@ -0,0 +1,67 @@
package com.csase;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
/*
* Represents a study planner with a list of assignments
*/
public class StudyPlanner {
private ArrayList<Assignment> assignments; // list of assignments
private String[] options; // list of options
/*
* Sets assignments and options
*/
public StudyPlanner() {
assignments = new ArrayList<Assignment>();
options = new String[]{"1. Add Assignment", "2. List Assignments", "3. Exit"};
}
/*
* Returns list of assignments
*/
public ArrayList<Assignment> getAssignments() {
return assignments;
}
/*
* Adds a new assignment to the list of assignments
*/
public void addAssignment(String name, String dueDateString) {
LocalDate dueDate = LocalDate.parse(dueDateString, DateTimeFormatter.ISO_LOCAL_DATE);
assignments.add(new Assignment(name, dueDate));
}
/*
* Returns string representation of assignments
*/
public String listAssignments() {
String assignmentsString = "";
if (assignments.size() == 0) {
return "No assignments to list!\n";
}
for (Assignment assignment : assignments) {
assignmentsString += assignment.toString() + "\n";
}
return assignmentsString;
}
/*
* Returns string representation of options
*/
public String getOptions() {
String optionsString = "";
for (String option : options) {
optionsString += option + "\n";
}
return optionsString;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.