Write java application of

The users should only be able to add tasks to the application if they have logged in successfully.
2. The applications must display the following welcome message: “Welcome to EasyKanban”.
3. The user should then be able to choose one of the following features from a numeric menu:
21; 22; 23 2023
© The Independent Institute of Education (Pty) Ltd 2023 Page 10 of 22
a. Option 1) Add tasks
b. Option 2) Show report - this feature is still in development and should display the following message: “Coming Soon”.
c. Option 3) Quit
4. The application should run until the users selects quit to exit.
5. Users should define how many tasks they wish to enter when the application starts, the application should allow the user to enter only the set number of tasks.
6. Each task should contain the following information:
Task Name
The name of the task to be performed: “Add Login Feature”
Task Number
Tasks start with the number 0, this number is incremented and autogenerated as more tasks are added .
Task Description
A short description of the task, this description should not exceed 50 characters in length. The following error message should be displayed if the task description is too long:
“Please enter a task description of less than 50 characters”
OR
“Task successfully captured” if the message description meets the requirements.
Developer Details
The first and last name of the developer assigned to the task.
Task Duration
The estimated duration of the task in hours. This number will be used for calculations and should make use of an appropriate data type.
Task ID
The system must autogenerate a TaskID which contains the first two letters of the Task Name, a colon (:), the Task Number, a colon (:) and the last three letters of the developer

import java.util.Scanner;

public class EasyKanban {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Welcome to EasyKanban");

// login feature
boolean isLoggedIn = false;
while (!isLoggedIn) {
System.out.println("Please log in to continue");
System.out.print("Username: ");
String username = input.nextLine();
System.out.print("Password: ");
String password = input.nextLine();
if (validateLogin(username, password)) {
System.out.println("Login successful!\n");
isLoggedIn = true;
} else {
System.out.println("Invalid username or password, please try again.\n");
}
}

// menu options
int numTasks = 0;
boolean quit = false;
while (!quit) {
System.out.println("Please choose an option from the menu:\n" +
"1) Add tasks\n" +
"2) Show report\n" +
"3) Quit");
int choice = input.nextInt();
input.nextLine(); // clear scanner buffer
switch (choice) {
case 1:
System.out.print("Enter the number of tasks you wish to add: ");
numTasks = input.nextInt();
input.nextLine(); // clear scanner buffer
addTasks(numTasks, input);
break;
case 2:
System.out.println("Coming soon");
break;
case 3:
System.out.println("Goodbye!");
quit = true;
break;
default:
System.out.println("Invalid choice, please try again.\n");
break;
}
}
}

// method to validate user login
public static boolean validateLogin(String username, String password) {
// put your login validation logic here
return true;
}

// method to add tasks
public static void addTasks(int numTasks, Scanner input) {
for (int i = 0; i < numTasks; i++) {
System.out.print("Task Name: ");
String taskName = input.nextLine();
String taskNum = Integer.toString(i);
System.out.print("Task Description: ");
String taskDesc = input.nextLine();
if (taskDesc.length() > 50) {
System.out.println("Please enter a task description of less than 50 characters");
i--; // decrement counter to redo current task
continue;
}
System.out.print("Developer First Name: ");
String devFirstName = input.nextLine();
System.out.print("Developer Last Name: ");
String devLastName = input.nextLine();
System.out.print("Task Duration (hours): ");
int taskDuration = input.nextInt();
input.nextLine(); // clear scanner buffer
String taskID = taskName.substring(0,2) + ":" + taskNum + ":" + devLastName.substring(devLastName.length()-3);
System.out.println("Task successfully captured\n" +
"Task ID: " + taskID + "\n");
}
}
}

Sure! Here's a Java application that implements the given requirements:

```java
import java.util.Scanner;

public class KanbanApp {
private static Scanner scanner = new Scanner(System.in);
private static int taskCount = 0;

public static void main(String[] args) {
displayWelcomeMessage();
login();
displayMenu();
processUserChoice();
}

private static void displayWelcomeMessage() {
System.out.println("Welcome to EasyKanban");
}

private static void login() {
System.out.print("Please enter your username: ");
String username = scanner.nextLine();

System.out.print("Please enter your password: ");
String password = scanner.nextLine();

// Perform login validation here (e.g., check username and password against a database)
// If login is successful, allow adding tasks
// If login fails, display an error message and terminate the program
boolean loginSuccessful = validateLogin(username, password);
if (!loginSuccessful) {
System.out.println("Invalid username or password. Exiting...");
System.exit(0);
}
}

private static boolean validateLogin(String username, String password) {
// Implement login validation logic here (e.g., compare with stored credentials)
// Return true if login is successful, false otherwise
return true; // Placeholder
}

private static void displayMenu() {
System.out.println("Menu:");
System.out.println("1) Add tasks");
System.out.println("2) Show report (Coming Soon)");
System.out.println("3) Quit");
}

private static void processUserChoice() {
boolean exit = false;
while (!exit) {
System.out.print("Enter your choice: ");
int choice = scanner.nextInt();
scanner.nextLine(); // Consume the newline character

switch (choice) {
case 1:
addTasks();
break;
case 2:
System.out.println("Coming Soon");
break;
case 3:
exit = true;
break;
default:
System.out.println("Invalid choice. Please try again.");
}
}
}

private static void addTasks() {
System.out.print("Enter the number of tasks to add: ");
int numTasks = scanner.nextInt();
scanner.nextLine(); // Consume the newline character

for (int i = 0; i < numTasks; i++) {
System.out.println("Task " + (i + 1) + ":");
System.out.print("Task Name: ");
String taskName = scanner.nextLine();

System.out.print("Task Description: ");
String taskDescription = scanner.nextLine();
if (taskDescription.length() > 50) {
System.out.println("Please enter a task description of less than 50 characters");
continue;
}

System.out.print("Developer First Name: ");
String firstName = scanner.nextLine();

System.out.print("Developer Last Name: ");
String lastName = scanner.nextLine();

System.out.print("Task Duration (in hours): ");
double taskDuration = scanner.nextDouble();
scanner.nextLine(); // Consume the newline character

String taskID = generateTaskID(taskName, firstName, lastName);

System.out.println("Task successfully captured");
System.out.println("Task ID: " + taskID);
System.out.println("------------------------------");
}
}

private static String generateTaskID(String taskName, String firstName, String lastName) {
String taskID = taskName.substring(0, 2).toUpperCase()
+ ":" + taskCount
+ ":" + lastName.substring(lastName.length() - 3).toUpperCase();

taskCount++;

return taskID;
}
}
```

This application allows the user to log in and perform operations based on a menu choice. If the user chooses to add tasks, they can enter the details for each task, including the task name, description, developer details, duration, and an autogenerate task ID based on the requirements.

Note: You will need to implement the login validation logic and replace the placeholder code inside the `validateLogin` method with your own implementation.