Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROJECT DESCRIPTION This project has you examine the task management process, which is an important part of the realm of Management Science. Imagine an enterprise

PROJECT DESCRIPTION

This project has you examine the task management process, which is an important part of the realm of Management Science.

Imagine an enterprise that wishes you to design an application which assigns tasks to processors and determines the overall running time of the completed tasks as well as any processor idle time. Considering the task list given below, the enterprise wants you to run these tasks on two of their processors.

Your program is to define the tasks and their durations. Then the program will assign the tasks to the processors and keep track of the status of the tasks and even the total running time of the entire operation.

Basically, your task management program works as follows:

A list of tasks and their completion durations are presented to the processors. We will assume here that all of the tasks are independent of each other and not prioritized, whereby one task cannot be started without any dependent tasks being completed.

The lowest numbered processor will take the first ready task on the list and work on that task until it is completed. Then, while the first processor is completing their given task, the next processor will then take the next ready task on the list. This process of assigning tasks to processors continues until the tasks are all finished. The total running time of the completed task list is then reported.

As the tasks are being completed a task management program will report the status of the task ( open, in use, closed ) , the processor that is working on the task, the time of duration for the task and any processor that could be idle.

Your initial program is outlined in the given starter code statements shown within Figure 1 , which follows. Review the starter code to understand the mechanisms of the interactions between the ArrayList and the local variables. Perform any modifications according to this projects instructions.

Type, compile and run the basic Java program that is shown in Figure 1 , which follows. Then modify the program accordingly.

Task List

task list

Task 1

Task 2

Task 3

Task 4

Task 5

task durations

20

25

18

9

13

task status

Open

Open

Open

Open

Open

Information About This Project

The concept of task management involves these attributes:

processors, i.e. human employees or robots

a list of tasks, which could be independent or part of a task priority list

Steps to Complete This Project

STEP 1 Open NetBeans or Eclipse

Open NetBeans or Eclipse and create a Java project with the following details.

For Project Name include: TaskManagement

For the Main Class include: TaskManagement

In your Code window for this class, shown below, copy the program code shown in Figure 1 below, in the appropriate places, except substitute your own name in place of Sammy Student.

PROJECT Java Applications: Task Management Application

Figure 1 Source Code for the Task Management Program

import java.util.ArrayList;

import java.util.Arrays;

import java.util.Scanner;

// Programmer: Sammy Student

public class TaskManagement

{

public static void main(String[] args)

{

try

{

Scanner scan = new Scanner(System.in);

// define the tasks

ArrayList theTasks = new ArrayList

(Arrays.asList("Task 1", "Task 2", "Task 3", "Task 4", "Task 5"));

// define the task durations

ArrayList theDurations = new ArrayList

(Arrays.asList(20, 25, 18, 9, 13));

// define the task status

ArrayList theStatus = new ArrayList

(Arrays.asList("Open", "Open", "Open", "Open", "Open"));

// define the current task

int num = 0;

// define the processors

int processor1 = 0;

int processor2 = 0;

// define the total running time

int TRT = 0;

// display initial data

listTasks(theTasks);

listDurations(theDurations);

listStatus(theStatus);

// commence the processing

// assign the duration of Task 1 to processor 1

// change the status of Task 1

// update the total running time of the complete process

PROJECT Java Applications: Task Management Application

Figure 1 Source Code for the Task Management Program ( continued )

num += 1;

processor1 += theDurations.get(0);

theStatus.set(0, "In Use");

TRT += theDurations.get(0);

// show current process

showProgress(num, processor1, theStatus.get(0), TRT);

// display current data

listTasks(theTasks);

listDurations(theDurations);

listStatus(theStatus);

// continue the task processing

scan.close();

}

catch (Exception e)

{

e.getMessage();

}

}

public static void listTasks(ArrayList tasks)

{

System.out.println(" ");

for (int i = 0; i < tasks.size(); i++)

{

System.out.print(tasks.get(i) + "\t");

}

System.out.println(" ");

}

public static void listDurations(ArrayList durations)

{

System.out.println(" ");

for (int i = 0; i < durations.size(); i++)

{

System.out.print(durations.get(i) + "\t");

}

System.out.println(" ");

}

PROJECT Java Applications: Task Management Application

Figure 1 Source Code for the Task Management Program ( continued )

public static void listStatus(ArrayList status)

{

System.out.println(" ");

for (int i = 0; i < status.size(); i++)

{

System.out.print(status.get(i) + "\t");

}

System.out.println(" ");

}

public static void showProgress(int n, int processor, String s, int total)

{

System.out.println(" ");

System.out.println("Task Number" + "\t" + n );

System.out.println("task time" + "\t" + processor );

System.out.println("task status" + "\t" + s );

System.out.println("total time" + "\t" + total );

System.out.println(" ");

}

}

STEP 2 Review the Starter Source Code

Before running the program, examine the logic behind the statements that comprise the starter code.

STEP 3 Build, Compile and Run the Program

From the menu select [ Run ] and click [ Run Project ] to run your app.

Observe the program's output, which should appear similar to this sample run.

[ Sample Output ]

Task 1 Task 2 Task 3 Task 4 Task 5

20 25 18 9 13

Open Open Open Open Open

Task Number 1

task time 20

task status In Use

total time 20

Task 1 Task 2 Task 3 Task 4 Task 5

20 25 18 9 13

In Use Open Open Open Open

PROJECT Java Applications: Task Management Application

STEP 4 Modify Your Program

With your program running successfully, write additional code statements to complete the process of assigning tasks to the processors until all of the tasks have been assigned and completed.

You can include here a looping structure to cycle through each of the tasks on the list.

Save your program to update it and perform a trial run of your modified code.

Take screen snapshots showing the results of the execution of your program.

STEP 5 Submit Your Project

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions

Question

5. A review of the key behaviors is included.

Answered: 1 week ago