Question: Directions: Project: Lab _ 1 3 _ FileListMaker You will refactor our Lab 1 1 Listmaker lab. ( For your convenience, I have attached the

Directions:
Project: Lab_13_FileListMaker
You will refactor our Lab 11 Listmaker lab. (For your convenience, I have attached the lab 11 directions here at the end of this doc. You should not have to redo Lab 11...)
Instead of a single list held in memory, the new refactored program will be able to save and load lists from disk.
In addition to these existing options:
A Add an item to the list
D Delete an item from the list
P - Print the list to the screen Change this to V for view
Q Quit the program
You will add:
O Open a list file from disk
S Save the current list file to disk
C Clear removes all the elements from the current list
V - CHANGE THE P Print OPTION to V for View
You might notice that there is no explicit option for creating a new list. To do this, we merely use the add option to build the list in memory.
The big challenge here is to keep track of the program state:
o Use a boolean variable like needsToBeSaved to keep track of list edits. (Traditionally this has been called a dirty flag. The file becomes dirty when it needs to be saved.
o If the user loads a list it does not need to be saved until it is changed by adding or deleting items. (The user could load a list only to view it and then would want to load another in its place without saving...)
o If the user begins to build a list by adding items and does not load an existing list keep track of this new list. Prompt the user on exit to save the list or abandon it.
o Similarly, prompt the user to save an unsaved list before loading a new list from disk.. etc.
o Loaded lists are always saved with the same filename.
o All list files have the .txt extension
1. Name your project: Lab13_FileListMaker
2. Implement and thoroughly test your refactored code.
3. Provide a series of screen shots that document and establish that your program:
- Will load a list from disk
Will save a list loaded from disk that has been modified by deleting or adding items using the same filename so it overwrites the file. Reload the changed file to clearly show that you were able to save the changes
- Will allow the user to create a new list and save it to disk with a provided basename. List files should have the .txt extension.
- bullet proof the program so that a user cant loose data:
- if they ask to load a file but have an unsaved list in memory, prompt them to first save the list.
- if they go to quit the program and have an unsaved list prompt them
Submission:
Submit this file Lastname_Firstname_Lab_13_FileListMaker.docx using your name. Then submit either your GitHub repo link or your complete project archive of your IntelliJcolde. Lastname_Firstname_Lab_13_FileListMaker.zip.
THIS IS THE PREVIOUS LAB THAT YOU ARE REFACTORING AND IS HERE FOR YOUR CONVENIENCE ONLY. DONT DO THIS!!!
IT 1090C Computer Programming I
IT 6090C Java Programming
Prof. Tom Wulf
Lab 11: ListMaker
20 pts
Learning Goals:
Work with the ArrayList to create a dynamic list
The user can Add and item, Remove an item, Print the list of items, or Quit
Use the SafeInput library we created for the input
Directions:
1. Start by creating a menu driven loop:
a. The Loop awaits user input repeating until the Quit command is issued
b. Options: (Details of the options are below)
A Add an item to the list
D Delete an item from the list
P - Print the list to the screen
Q Quit the program
c. The program gets one of these commands from the user and executes that function
d. Initially stub out the functions so you have a program that you can run almost immediately as you develop it. You will develop each of the menu options as a separate java method.
e. You also will need some utility functions. These should be private static methods located in the same file as your java main().
i. You will want to display the current list along with the menu of options so the user can see what they are doing. (Just like we display the current board in Tic Tac Toe each turn...)
ii. You also need to display the menu or options and prompt. Some analysis shows that we will need to display the list each time prior to displaying the menu.
iii. You need to display a numbered version of the list to allow users to pick list elements for deletion. Here the user looks at the display and then indicates the item to delete by the number. You should use 1 based indexing for the user (items begin at 1) and convert it to java indexing by subtracting one since indexing is zero based. (Again, this is like the conversion of the board coordinates in Tic Tac Toe from 1-3 to 0-2.) You can also use this method to display the list to the user for the menu Print option.
f. Option Details:
Add - prompt the user for a String entry for the list. Make sure the String is not empty (i.e. zero-length) add the new list item to the end of the list.
Delete if there are no items in the list, display a status

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!