Welcome to the Assignment Compiler Project repository! This project is mainly focused on BRACU's CSE111 Programming Language II course's assignment submission, to help us ease the task of copying and pasting numerous assignment files into one text file, which is the only valid and accepted format of assignment submission for this course.
This project provides a utility to compile multiple assignment files into a single .txt
file with proper formatting, adhering to university submission requirements. The program is designed to save time, ensure consistency, and reduce manual errors.
- Project Availability
- Used Packages and Technologies
- Prerequisites
- Project Features
- Installation
- Running the Program
- Testing with Sample Files
- Sample Output File Example
- Contributing
- License
This project is currently a local utility tool and does not have a live deployment. Follow the instructions in the Installation and Running the Program sections to use it.
-
Java:
- For the core implementation of the utility.
- Utilized packages for file handling:
java.io.File
: To handle file paths, check file existence, and create files or directories.java.util.Scanner
: For reading file contents and accepting user inputs during runtime.java.io.FileWriter
andjava.io.BufferedWriter
: For writing formatted outputs to a text file.
java.util.concurrent.atomic.AtomicInteger
: For thread-safe counting of task numbers during file processing.
-
OOP Design Patterns:
Encapsulated file handling and processing logic for clean and modular code. -
Command-Line Interface (CLI):
Provides a simple interface to interact with the tool.
- JDK 11 or higher
- A text editor or IDE (e.g.,
IntelliJ IDEA
,Eclipse
,Visual Studio Code
)
-
File Compilation:
Combines multiple assignment files into a single.txt
file with proper formatting. Each task is separated by comments like// TASK 1
,// TASK 2
. -
Input Flexibility:
Allows you to specify which files to include in the compiled document. -
Automated Naming Convention:
Automatically names the output file using a standard format (Assignment XX_Your-ID_Your-Name.txt
). -
File Type Support:
Supports multiple file extensions, including Java, Python, C, C++, HTML, CSS, JavaScript, TypeScript, and others. You can modify the supported file extensions directly in the code. The current supported extensions are:- js
- ts
- html
- css
- xml
- txt
- java
- py
- cpp
- c
- cs
-
Subdirectory Handling:
Processes files in subdirectories, making it easier to handle projects with complex folder structures. However, it is highly recommended to keep all files in the main/root directory of the provided path, as issues might occur if files are spread across multiple subdirectories. -
Automated Task Sequence Detection:
Automatically detects numbered task sequences (e.g.,Task 1
,Task 2
ortask1
,task2
orTask-01
,Task-02
etc.) from file names. If the sequence is not in order, you can manually input or reorder the tasks in the correct sequence. -
Manual Task Sequence Detection:
If fails to detect a proper sequence or if your files are not named consistently, you’ll be prompted to manually provide the correct sequence for each file. This ensures that the tasks are ordered correctly before generating the final output. -
Combining Multiple Files as One Task:
Also allows you to combine multiple files into a single task in the generated output. If you have related files that should be considered part of the same task, you can group them together, and they will be treated as one task in the final document. -
Removing
package
Statements:
Automatically detects and removespackage
statements from the top of Java files. If apackage
statement is present, it is excluded from the generated output, ensuring that the file content starts immediately from the next statement, with trailing blank lines removed for a clean format. -
Error Handling:
Validates input files to ensure they exist and are formatted correctly. -
Empty Directory Detection:
Detects and rejects empty directories if provided, ensuring only valid directories containing files are processed. -
Handling Files with the Same Name:
Provides 3 options to the user if a file with the same name already exists in the directory :- Overwrite: Replaces the existing file with the new one.
- Create New Version: Generates a new version of the file with a suffix like
(1)
,(2)
, etc., appended to its name. - Skip: Skips the current file writing operation entirely.
-
Tailored for BRAC University:
Specifically designed to assist students in BRAC University's CSE111 - Programming Language II course. The utility simplifies the task of combining multiple assignment files into the.txt
format, which is the only valid and accepted format for assignment submissions in this course. -
Future GUI Support:
Plans for a graphical user interface to simplify the process further.
-
Clone the repository:
git clone https://github.com/Tanzeebul-Tamim/Assignment-Compiler.git cd Assignment-Compiler
-
Create a
bin
directory to store compiled.class
files:mkdir bin
-
Compile the Java source files:
javac -d bin src/Main.java src/utilities/*.java
-
Navigate to the
bin
directory:cd bin
-
Run the program:
java Main
-
Follow the prompts:
When you run the program, you’ll be guided through several input steps. Here's what to expect:
-
Enter the Assignment Number:
You’ll be asked to input the assignment number, such as3
for Assignment 03. The program supports assignment numbers ranging from1
to15
. Make sure to input a valid number within this range. -
Enter Your ID:
You’ll then be prompted to enter your 8-digit student ID (e.g.,24100000
). The program verifies the ID to ensure a valid ID is provided. -
Enter Your Name:
You’ll be then asked to input your name. The program automatically corrects improper naming conventions. For example, if you enter something liketANzEEBuL tAMiM
, it will be converted to the proper format:Tanzeebul Tamim
. -
Enter the File Extension:
Requires you to specify the desired file extension (e.g.,java
,py
,cpp
) to filter out unsupported or irrelevant files. It validates your input to ensure it matches one of the supported extensions and rejects any invalid or unsupported file types. -
Enter the Path to Your Assignment Folder:
Requires the folder path where your assignment files are stored. You can copy the file path directly from your file explorer:- Right-click the folder containing your assignment files in your file explorer.
- Select "Copy as path" to copy the full folder path.
- (e.g.,
C:\Users\Tamim\Documents\Assignments\OOP_Tasks
)
- Right-click the folder containing your assignment files in Finder.
- Select "Copy 'FolderName' as Pathname" to copy the path directly.
- (e.g.,
/Users/tamim/Documents/Assignments/OOP_Tasks
)
- Right-click the folder containing your assignment files in your file manager (e.g., KDE Dolphin).
- Select "Copy Location" to copy the full folder path.
- (e.g.,
/home/tamim/Documents/Assignments/OOP_Tasks
)
After copying the path, paste it directly into the program's terminal/console.
-
Sequencing Options:
At the start, you’ll be asked if you want to sequence or reorder your files:-
If you choose "Yes":
The program will detect any existing sequence:-
If all files are sequentially named (e.g.,
Task 1
,Task 2
ortask1
,task2
orTask-01
,Task-02
), it will use this order. -
If no sequence is found, you’ll be prompted to manually assign a sequence number to each file.
-
If some files have sequence numbers and others don’t, you’ll decide whether to resequence all files or only the ones without a sequence.
-
While manually sequencing:
You can choose from the following options for each file:- Enter a sequence number:
Assigns a sequence number (within the allowed range) to the file. - Enter "Skip":
Excludes the file from the sequence & the generated output file. - Enter "Previous":
Goes back to the previous file and lets you reassign its sequence number. - Enter "Reset":
Restarts the sequencing process for all files. - Enter "Merge":
Combines the current file with one or more selected files. Allows you to group related files together that should be treated as part of the same task, and they will be counted as a single task in the final output file.
- Enter a sequence number:
-
-
If you choose "No":
Generates the output using the file sequence as found in the file explorer.
-
-
Important Considerations for File Organization:
Before using the Assignment Compiler, ensure your files are properly organized for smooth processing. Here’s what to keep in mind:-
Dedicated Folder for Assignment Files:
Place all assignment-related files in a single folder. Avoid including unrelated files (e.g., images, documents) to prevent unnecessary errors. -
Verify File Relevance:
Double-check that all the files in the folder are part of your assignment. This reduces the risk of mistakenly including irrelevant or incomplete files in the output. -
File Naming Conventions:
For best results, use a consistent naming pattern like:Task-01
,Task-02
, ortask1
,task2
, orTask_01
,Task_02
.
This naming convention allows the program to automatically detect the correct order of tasks.
-
Manual Sequencing (If Needed):
Prompts you to manually arrange the task order if your files are not named sequentially or don’t follow a consistent pattern. This ensures that your final output file is properly structured, sequenced, and adheres to the assignment submission requirements.Note:
In the OOP tasks assigned by BRAC university, class-names often don’t follow any naming sequence. Instead, they use random names that are relevant to the task (e.g.,Circle
,Employee
,BankAccount
). This makes manual sequencing especially important to ensure that the tasks are arranged correctly before generating the output file.
-
-
Following these steps will ensure a smooth file compilation process.
To help you test the program, a Sample Folder
is included in the root directory.
Sample Folder Contents:
- Sample files with supported extensions and various naming formats (e.g.,
Task1.java
,task_03.java
,task__7.java
) to showcase the program's ability to detect sequences in different naming formats. - Files without any numeric sequence to demonstrate how the program prompts for manual sequencing (e.g.,
NonSequenced.java
,Unsequenced.java
,No_Sequence.java
,Not_Sequenced.java
). - Files with unsupported extensions (e.g.,
Unsupported.py
,Unsupported.ts
,Unsupported.txt
),Unsupported.ipynb
).Note:
Some files have supported extensions but are demonstrated as unsupported in theSample Folder
to illustrate that theSample Folder
is specifically designed for testing Java Files as the desired file type. - Two generated output files:
Assignment 05_24100000_Joe Brooks.txt
Assignment 05_24100000_Joe Brooks(1).txt
These files demonstrate how the program generates output files with proper naming formats and how it handles cases where files with the same name already exist.
How to Use the Sample Folder:
- Navigate to the Sample Folder folder in the root directory.
- Copy the path to the Sample Folder folder and paste it when prompted during program execution.
- Test the program's functionality with the pre-included sample files to familiarize yourself with its features.
Feel free to modify or add your own files to the Sample Folder to test with your own files.
Here is a sample output generated by the program:
Assignment 05_24100000_Joe Brooks.txt
// TASK 1
public class Task1 {
public static void main(String[] args) {
// This file demonstrates a simple sequential task (Task1)
// It helps test how the program handles files with standard naming formats (e.g., Task1, Task2)
System.out.println("I am Task1");
}
}
// TASK 2
public class TASK___2 {
public static void main(String[] args) {
// This file demonstrates a non-standard naming convention (TASK___2)
// It will help test how the program handles files with unusual sequence formats
System.out.println("I am TASK___2");
}
}
// TASK 3
public class task_03 {
public static void main(String[] args) {
// This file demonstrates a naming convention with underscores (task_03)
// It helps test how the program detects sequences in files with this format
System.out.println("I am task_03");
}
}
// TASK 4
public class Task4 {
public static void main(String[] args) {
// This file demonstrates a simple sequential task (Task4)
// It helps test how the program handles files with standard naming formats (e.g., Task1, Task2)
System.out.println("I am Task4");
}
}
// TASK 5
public class NonSequenced {
public static void main(String[] args) {
// This file doesn't follow a sequential naming convention
// It is meant to test how the program handles files without a sequence
System.out.println("I am NonSequenced");
}
}
This sample demonstrates how tasks are numbered and formatted consistently, ensuring compliance with BRAC University's assignment submission requirements. The program handles task numbering, file naming, and proper organization for effortless submissions.
Contributions are welcome! Whether it's bug fixes, feature enhancements, or new ideas, feel free to fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.