QuestionQuestion

1. You will implement code for the following use case:

As a developer I want to be able to a obtain summary statistics of tasks by size so that I can understand my time spent on work across all tasks.
You need to implement three statistics based on last weeks t-shirt size. For each statistic you only need to report it for tasks of sizes that exist and for which there are at least two such tasks. So if there are two large tasks and one small task you will provide summary statistics for the two large tasks.

1. min: computes the minimum time spent on tasks of a particular size
2. max: computes the maximum time spent on tasks of a particular size
3. avg: computes the average time (mean) spent on tasks of a particular size
If there is only one, min/max/average do don’t print.

2. You will implement the code for the following use case

As a developer I want to be able to rename a task so that I my report will be more clear as my knowledge of the project evolves.
Ideally, read in the old txt, correct it, delete the old one and the corrected one is the only one that exists.
Easy of data was serialized (for both rename and delete).

We will do this by adding a rename command which takes the original task name and the new task name.

java TM rename <old task name> <new task name>

You may process the text file and rename old log entries if you wish, however, this is working harder than necessary for this assignment. However, if you do not rename old entries then your summary command will have to combine task data when it encounters a rename command for a task. The approch is your choice. Try to think up front which approach will end up being more work for you.

Also once a task is renamed, then the old name is available for new tasks, consequently, if you decide not to edit the log file, then you must condition your renaming on only tasks with the old name prior to a rename command.

This could be tricky. How will you handle multiple rename commands for the same group of tasks?

3. You will implement the code for the following use case

As a developer I want to be able to delete a task so that I my report will be more clear as my knowledge of the project evolves.

We will do this by adding a delete command.

java TM delete <task name>

As with the rename comman, you may process the text file and delete old log entries if you wish. You may also just choose to flag deleted tasks as those which should not be summarized and just exclude them from the output. Again, the approch is your choice. Try to think up front which approach will end up being more work for you.

Also once a task is deleted then the old name is available for new tasks, consequently, if you decide not to edit the log file, then you must condition your summary exclusion on only task entries that existed prior to the delete command.

As with rename, this could be tricky. Make sure that you think about what data will be affected by deletion if you do not physically delete the tasks from the log.

4. You will need to refactor your code separating the user interface from the business logic in accordance with an interface to be provided. We will discuss this in class on Friday.
Main TM class should be broken up into at least two public classes: class TM Model, class TM (interacts with user).

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class TM_Model {

    private final String logFile = "timelog.txt";

    public TM_Model() {
    }

    public void process(String[] args) {

       // get comamand
       String command = args[0];
       if (command.equals("summary")) {
            summary(args);
       } else if (command.equals("start")) {
            start(args);
       } else if (command.equals("stop")) {
            stop(args);
       } else if (command.equals("size")) {
            size(args);
       } else if (command.equals("describe")) {
            describe(args);
       } else if (command.equals("max")) {
            max(args);
       } else if (command.equals("min")) {
            min(args);
       } else if (command.equals("avg")) {
            avg(args);
       } else if (command.equals("rename")) {
            rename(args);
       } else if (command.equals("delete")) {
            delete(args);
       }
    }

    private void delete(String[] args) {
       if (args.length == 2) {
            String task = args[1];
            // initialize the log file
            Log log = new Log(logFile);
            log.delete(task);
       }
    }

    private void rename(String[] args) {
       if (args.length == 3) {
            String oldTask = args[1];
            String newTask = args[2];
            // initialize the log file
            Log log = new Log(logFile);
            log.rename(oldTask, newTask);
       }
    }

    private void max(String[] args) {
       if (args.length == 2) {
            String size_ = args[1];
            // initialize the log file
            Log log = new Log(logFile);
            log.max(size_);
       }
    }

    private void min(String[] args) {
       if (args.length == 2) {
            String size_ = args[1];
            // initialize the log file
            Log log = new Log(logFile);
            log.min(size_);
       }
    }...

By purchasing this solution you'll be able to access the following files:
SolutionModel.java and Solution.java.

$64.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats