0% found this document useful (0 votes)
2 views3 pages

Import Java

Uploaded by

madhusethiaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Import Java

Uploaded by

madhusethiaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import [Link].

ArrayList;

import [Link];

public class TodoList {

public static void main(String[] args) {

ArrayList tasks = new ArrayList();

Scanner sc = new Scanner([Link]);

int choice;

do {

[Link]("TO-DO LIST");

[Link]("1. Add task");

[Link]("2. View ");

[Link]("3. Remove");

[Link]("4. Exit");

[Link]("Enter choice: ");

choice = [Link]();

[Link]();

switch(choice) {

case 1:

[Link]("Enter task: ");

String task = [Link]();

[Link]("Task added!");

break;

case 2:

if([Link]()) {

[Link]("No tasks yet");

} else {
[Link]("Your tasks:");

for(int i = 0; i < [Link](); i++) {

[Link]((i+1) + ". " + [Link](i));

break;

case 3:

[Link]("Enter task number to remove: ");

int num = [Link]();

if(num > 0 && num <= [Link]()) {

[Link](num-1);

[Link]("Task removed!");

} else {

[Link]("Invalid number");

break;

case 4:

[Link]("bye!");

break;

default:

[Link]("Invalid choice");

} while(choice != 4);

You might also like