To Do list App

The To-Do List App is a command-line task manager developed in Java that helps users create, manage, and track daily tasks. It makes use of Java’s collection framework, primarily ArrayList, to dynamically store and manipulate tasks. Each task has a title and a status (Pending/Completed). Users can add new tasks, view all current tasks, mark tasks as completed, and delete tasks. This application is a perfect introduction to task-based programming and emphasizes how to build interactive console applications that simulate productivity tools. It also enhances the developer’s understanding of list-based operations and user interface design in text-based environments.

The To-Do List App is a console-based Java application that helps users manage and track their daily tasks efficiently. It is designed to simulate the core functionality of task management systems by allowing users to add, view, update (mark as completed), and delete tasks. This project reinforces the use of Java collection frameworks and demonstrates how simple user-driven applications can be developed using basic data structures and input/output operations.

📌 Key Features:

  • Add Task: Users can add new tasks by providing a task title or description.

  • View Tasks: Displays all tasks in a list format with their respective statuses – either “Pending” or “Completed.”

  • Mark as Completed: Enables users to update the status of any task to mark it as completed.

  • Delete Task: Allows users to remove a specific task from the list.

🔧 Technologies & Concepts Used:

  • ArrayList: All tasks are stored in a dynamic list, allowing for easy addition, removal, and updating.

  • Classes & Objects: Each task is treated as an object, encapsulating details like task title and completion status.

  • Encapsulation & Data Management: Uses getter and setter methods to access and modify task data.

  • Control Flow & Input Handling: Implements condition-based menus and user-friendly input using the Scanner class.

  • Console Interface: A menu-driven interface helps users interact with the system without needing a graphical UI.

🎯 Learning Outcomes:

Through this project, learners gain hands-on experience in:

  • Implementing Object-Oriented Programming (OOP) concepts.

  • Using Java Collections for managing in-memory data.

  • Handling real-time user input and updating program state dynamically.

  • Building simple, interactive, and functional console applications.

🔄 Future Scope:

This basic console version can be enhanced further by:

  • Adding data persistence using files or databases.

  • Introducing due dates, priority levels, or task categories.

  • Developing a Graphical User Interface (GUI) using Java Swing or JavaFX.

  • Syncing with calendar apps or notification systems.

  • Allowing task history tracking or undo/redo actions.

✅ Conclusion:

The To-Do List App is a beginner-friendly yet practical Java project that simulates everyday productivity tools. It enhances understanding of Java’s core features such as classes, objects, collections, and user interaction. This project demonstrates how even a simple Java application can be highly useful in solving real-world problems like task management and organization.

ToDoListApp.java

import java.util.ArrayList;
import java.util.Scanner;

class Task {
    private String title;
    private boolean isCompleted;

    public Task(String title) {
        this.title = title;
        this.isCompleted = false;
    }

    public String getTitle() {
        return title;
    }

    public boolean isCompleted() {
        return isCompleted;
    }

    public void markAsCompleted() {
        isCompleted = true;
    }

    public void display(int index) {
        String status = isCompleted ? “✅ Completed” : “⌛ Pending”;
        System.out.println(index + “. ” + title + ” [” + status + “]”);
    }
}

public class ToDoListApp {
    private static ArrayList<Task> tasks = new ArrayList<>();
    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int choice;
        do {
            System.out.println(“\n📝 To-Do List Application”);
            System.out.println(“1. Add Task”);
            System.out.println(“2. View Tasks”);
            System.out.println(“3. Mark Task as Completed”);
            System.out.println(“4. Delete Task”);
            System.out.println(“0. Exit”);
            System.out.print(“Choose an option: “);
            choice = sc.nextInt();

            switch (choice) {
                case 1 -> addTask();
                case 2 -> viewTasks();
                case 3 -> markTaskCompleted();
                case 4 -> deleteTask();
                case 0 -> System.out.println(“👋 Exiting…”);
                default -> System.out.println(“❌ Invalid option.”);
            }
        } while (choice != 0);
    }

    private static void addTask() {
        sc.nextLine(); // consume newline
        System.out.print(“Enter task title: “);
        String title = sc.nextLine();
        tasks.add(new Task(title));
        System.out.println(“✅ Task added.”);
    }

    private static void viewTasks() {
        if (tasks.isEmpty()) {
            System.out.println(“📭 No tasks available.”);
            return;
        }
        System.out.println(“\n📋 To-Do List:”);
        for (int i = 0; i < tasks.size(); i++) {
            tasks.get(i).display(i + 1);
        }
    }

    private static void markTaskCompleted() {
        viewTasks();
        if (tasks.isEmpty()) return;

        System.out.print(“Enter task number to mark as completed: “);
        int index = sc.nextInt();
        if (index > 0 && index <= tasks.size()) {
            tasks.get(index – 1).markAsCompleted();
            System.out.println(“☑️ Task marked as completed.”);
        } else {
            System.out.println(“❌ Invalid task number.”);
        }
    }

    private static void deleteTask() {
        viewTasks();
        if (tasks.isEmpty()) return;

        System.out.print(“Enter task number to delete: “);
        int index = sc.nextInt();
        if (index > 0 && index <= tasks.size()) {
            tasks.remove(index – 1);
            System.out.println(“🗑️ Task deleted.”);
        } else {
            System.out.println(“❌ Invalid task number.”);
        }
    }
}
Scroll to Top