1. Users should be able to use to populate the following arrays:
Array Contents
Developer Contains the names of all the developers
assigned to tasks
Task Names Contains the names of all the created tasks
Task ID Contains the generated taskID’s for all tasks
Task Duration Contains the Duration of all tasks
Task Status Contains the Status of all tasks
2. Users should be able to use these arrays to:
a. Display the Developer, Task Names and Task Duration for all tasks with the status of
done.
b. Display the Developer and Duration of the class with the longest duration.
c. Search for a task with a Task Name and display the Task Name, Developer and Task
Status.
d. Search for all tasks assigned to a developer and display the Task Name and Task
Status.
e. Delete a task using the Task Name.
f. Display a report that lists the full details of all captured tasks.
1 answer
```python
# Initialize empty arrays
Developer = []
Task_Names = []
Task_ID = []
Task_Duration = []
Task_Status = []
# Function to populate arrays
def populate_arrays():
while True:
dev = input("Enter developer name (or 'done' to stop): ")
if dev == 'done':
break
task_name = input("Enter task name: ")
task_id = input("Enter task ID: ")
task_duration = int(input("Enter task duration: "))
task_status = input("Enter task status: ")
Developer.append(dev)
Task_Names.append(task_name)
Task_ID.append(task_id)
Task_Duration.append(task_duration)
Task_Status.append(task_status)
# Function to display tasks with the status of done
def display_done_tasks():
print("Tasks with status 'done':")
for i in range(len(Task_Status)):
if Task_Status[i] == 'done':
print("Developer:", Developer[i])
print("Task Name:", Task_Names[i])
print("Task Duration:", Task_Duration[i])
print()
# Function to display developer and duration of the task with the longest duration
def display_longest_duration():
max_duration = max(Task_Duration)
max_duration_index = Task_Duration.index(max_duration)
print("Task with longest duration:")
print("Developer:", Developer[max_duration_index])
print("Task Duration:", Task_Duration[max_duration_index])
# Function to search for a task by name and display its details
def search_task_by_name():
task_name = input("Enter task name to search: ")
for i in range(len(Task_Names)):
if Task_Names[i] == task_name:
print("Task Name:", Task_Names[i])
print("Developer:", Developer[i])
print("Task Status:", Task_Status[i])
return
print("Task not found!")
# Function to search for all tasks assigned to a developer and display details
def search_tasks_by_developer():
developer_name = input("Enter developer name to search tasks: ")
found_tasks = False
for i in range(len(Developer)):
if Developer[i] == developer_name:
print("Task Name:", Task_Names[i])
print("Task Status:", Task_Status[i])
found_tasks = True
if not found_tasks:
print("No tasks found for developer", developer_name)
# Function to delete a task using the task name
def delete_task():
task_name = input("Enter task name to delete: ")
if task_name in Task_Names:
index = Task_Names.index(task_name)
Developer.pop(index)
Task_Names.pop(index)
Task_ID.pop(index)
Task_Duration.pop(index)
Task_Status.pop(index)
print("Task deleted successfully!")
else:
print("Task not found!")
# Function to display a report with full task details
def display_full_report():
print("Full Task Report:")
for i in range(len(Task_Names)):
print("Task Name:", Task_Names[i])
print("Task ID:", Task_ID[i])
print("Developer:", Developer[i])
print("Task Duration:", Task_Duration[i])
print("Task Status:", Task_Status[i])
print()
# Example usage
populate_arrays()
display_done_tasks()
display_longest_duration()
search_task_by_name()
search_tasks_by_developer()
delete_task()
display_full_report()
```
Note: This is just a basic implementation to showcase the functionality. You can modify and enhance it based on your specific needs and programming language.