Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

In this assignment, you should create a class called ToDoMenu which has a main method that contains the code that implements a command-line menu for managing a collection of ToDoItem objects. You will also create a class called ToDoList which contains a collection of ToDoItem objects and some methods for managing the data in that collection. You will reuse both the ToDoItem class and the ToDoUtil class that you wrote for p3.

*

The ToDoItem class needs to be modified to implement the Comparable interface.
*

A ToDoList is a collection of ToDoItem objects
o

The ToDoList class needs to contain an ArrayList of ToDoItem objects. Feel free to add any other variables that you think would be useful.
o

ToDoList needs methods to provide the following functionality:
+

Add a ToDoItem to the ToDoList.
+

Return the number of ToDoItem objects in the ToDoList.
+

Return a particular ToDoItem by index. This will allow you to write loops that process each ToDoItem in the ToDoList.
+

Return a reference to an array containing all the ToDoItem objects in the list. This array should be exactly the right size for the number of ToDoItems in your ToDoList.
+

Return an array containing all the ToDoItems in a particular category.
+

Add any other methods you find you need.
*

The ToDoUtil class provides the following static methods for input and output of ToDoItems and ToDoLists.

Method signature Functionality
Methods written for p3
ToDoItem inputToDoItem( Scanner in) Read a ToDoItem from the keyboard
void printToDoItem( PrintStream out, ToDoItem task) Output a ToDoItem to the PrintStream out in the following format

submit p3
school
3/8/12
7

Methods added for this program
ToDoItem readToDoItem( Scanner in) Read data for a ToDoItem from a file. This method should read the data that is output by the printToDoItem method. This method is very similar to the inputToDoItem method above but doesn''t need the user prompts. You can assume that the data comes in the order given above but you should be able to handle input with no field data.

design for p3



void printToDoList( PrintStream out, ToDoList theList) Output all the ToDoItems in a ToDoList to the PrintStream out. This method should use the printToDoItem method to output each ToDoItem.
void readToDoList( Scanner in, ToDoList theList) Read all ToDoItems in the file connected to the Scanner in (using readToDoItem) and add them to the given ToDoList. This method should be able to read a file that was output by the printToDoList method.

#

You need to write the main class, ToDoMenu, which consists of a main method which is basically a command-line menu that allows you to manage the items in your ToDoList.

*

The main method should create a ToDoList.
*

Your command-line menu should support the following options

Menu Choice Functionality
n create a new (empty) ToDoList
r Request the name of a file from the keyboard and read ToDoItems from that file (using readToDoList method) and add them to the current ToDoList.
i Read a single ToDoItem from the keyboard (using inputToDoItem) and add it to the ToDoList
d Display all ToDoItems to the console (using printToDoList)
w Write the ToDoItems to a file (using printToDoList) whose name is entered from the keyboard
f Display a submenu that allows the user to find and display all the ToDoItems that meet a particular criterion. Your program is required to support find by category and the option to find all ToDoItems with a particular keyword in the description. Use the menu choices shown in the table below.
s Display a submenu that allows the user to sort the ToDoList in order by a particular field. Sorting by due date is required. Use the same menu choices (shown in the table below) as in the find menu.
q Exit the program
* The find and sort menus should support the same selection characters. The c and k options in the find menu and the d option in the sort menu are required.

Menu Choice Find functionality Sort Functionality
k Find ToDoItems with a given keyword in the description. Sort ToDoItems by description.
c Find ToDoItems that have a particular category. The category should be read from the keyboard. Sort ToDoItems by category.
d Find ToDoItems with a given due date. Sort ToDoItems by due date.
p Find ToDoItems with a given priority. Sort ToDoItems by priority.
x Exit - return to the main menu.

Unimplemented options should do nothing except print a message.
*

This program should handle IOExceptions and all Exceptions due to bad input data. Handle any other exceptions that you find.
*

This program should either prevent or handle any Exceptions caused by missing data (e.g. a null dueDate).
*

Provide a file called todo-data.txt that contains data for ToDoItems (in the format that readToDoItem and printToDoItem read and write) to thoroughly test your methods and menu.
*

Extra Credit (Up to 15 points): Implement one or more of the find and sort options that aren''t required.
*

Extra Credit (+3 points): Add an optional command line argument which is the name of a file to read the initial ToDoList from. If the command line argument is not present, the initial ToDoList should be empty.
*

Extra Credit (+5 points): Create a runnable jar file for your project. This allows a user to simply double-click on the jar file to run the project. The name must be todo-menu.jar.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9502324

Have any Question?


Related Questions in Computer Engineering

Need help with a java program that takes two arrays a and b

Need help with a Java program that takes two arrays a and b of length 5 storing int values, and returns the dot product of a and b. That is, it returns an array c of length n such that c[i]=a[i]*b[i].

Design a combinational circuit with three inputs a b and c

Design a combinational circuit with three inputs: A, B, and C, D and the output W. The output should be 1 only when the values of A, B interpreted as an unsigned integer (AB) is equal to the values of C, D interpreted as ...

Question having separate level 1 caches for instructions

Question : Having separate level 1 caches for instructions and data is a popular technique. Describe how this might pay off if a short loop of code that is operating on a giant array. Imagine that instructions and data e ...

Discuss how the scope of computer security grew from

Discuss how the scope of computer security grew from physical security to include : Securing the data Limiting random and unauthorized access to that data. Involvement of personnel from multiple levels of the organizatio ...

Question suppose you work for a company ipuritancom that

Question : Suppose you work for a company, iPuritan.com, that has strict rules for when two employees, x and y, may date one another, requiring approval from their lowest-level common supervisor. The employees at iPurita ...

Suppose pointers are 4 bytes long and keys are 12 bytes

Suppose pointers are 4 bytes long, and keys are 12 bytes long. How many keys and pointers will a block of 16,384 bytes have?

Are there manufacturers and retailers who have taken steps

Are there manufacturers and retailers who have taken steps to reduce their pollution impact, both air quality and industrial pollution, while maintaining a viable place in the market?

What is the transmission type transmission form

What is the Transmission Type, Transmission Form, Transmission Speed, Address for Transmission and Collusion for hubs?

Consider the market for small business loans in the context

Consider the market for small business loans. In the context of this market. How adverse selection impact lenders. How does adverse selection impact borrowers? In the context of this market provide 2 things that a lender ...

student who is taking quizzes public class student

/** A student who is taking quizzes. */ public class Student { private String name; private double totalScore; private int quizCount; public Student (String n) { name = n; totalScore = 0; quizCount = 0; } public String g ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As