Rewrite all of the methods in the library class

Assignment Help JAVA Programming
Reference no: EM131585857

Final Project

Description

In this project we will improve our personal lending library tool by (1) adding the ability to delete items from the library, (2) creating a graphical user interface that shows the contents of the library and allows the user to add, delete, check out, or check in an item, (3) using a file to store the library contents so that they persist between program executions, and (4) removing the 100 item size restriction.

Sample Run

The video final.swf on the course website shows a sample run of this program.

Suggestions
You have the freedom to design your program however you want, provided that it meets the requirements and follows good design principles. However, if you would like some ideas of where to start, they are provided in this section.

- Modify the Library class to use an ArrayList rather than an array (to eliminate the size limit)

- Rewrite all of the methods in the Library class that display error messages to throw exceptions

- Add the following methods to the Library class:

- public void delete(String title) - Removes the item with this title from the library (the ArrayList of MediaItems)

- public void save() - Writes all of the items out to the data file library.txt. For each MediaItem, write its title, format, whether or not it is on loan (true/false), who it is loaned to (or null, if not on loan), and the date is was loaned (or null, if not on loan). Write out some weird symbol in between each of these things - be sure to pick something that is not likely to appear in a title or someone's name.

- public void open() - Reads in the data from library.txt, recreates the MediaItems, and puts them into the ArrayList. When you read in each line, you will need to tokenize it based on whatever symbol you picked. Then create a new MediaItem object and set the fields appropriately.

- Create a JavaFX LibraryGUI class

- This class should have a Library object as one of its fields. In the LibraryGUI constructor you will need to call the library constructor method to initialize this field and then call its open() method to read in the items from the data file.

- Use a javafx.scene.control ListView class to display the contents of the library (see Chapter 16 of Liang, pp. 647-651, as well as https://www.javafxcookbook.com/home).

The code below shows how to use the ListView control to display list of items (https://www.javafxcookbook.com/home). The control takes a data model (a sequence of items) as its data source. The code below shows how it is used:

ListView { width:w-200 height:h-50
effect:DropShadow{offsetY:3 offsetX:3} items: for (i in [1..50]) "Cloud {%5s i}"
}

The snippet above would produce the ListView shown in the following figure:

161_Figure.jpg

- Provide buttons for adding, deleting, checking in, and checking out items

- Attach action listeners to the buttons that use dialog boxes to get any required information from the user and then call the appropriate method in the library. If the user currently has an item selected in the list, assume this is the item they want to check in/check out/delete.
Hints
When the user has an item in the list selected and they choose to check in, check out, or delete that item, you will need to get the item's title in order to pass it to the appropriate library method. To do this, you can use the following code:
Object selected = list.getSelectedValue(); // gets the selected item String s = selected.toString(); // converts that to a String
String title = s.substring(0, s.lastIndexOf("(")); // extracts the title String title = title.trim(); // removes any trailing whitespace
You will need to call the Library class's save method when the user closes the application.
Rubric (Each item is worth four points, for a total of 52)
- The contents of the library persist across program executions

- The program allows the user to delete items

- The library is not limited to a set number of items

- The entire program is handled through a graphical interface (e.g. the console is no longer used at all)

- The GUI allows the user to see the contents of the library and add, delete, check in, and check out items

- The GUI indicates which items are on loan

- The user can choose which item to check in, check out, or delete by selecting it in the list rather than typing in the title

- The contents of the list are kept in sync with the contents of the library

- If an exception occurs, the program displays an appropriate error dialog box to the user

- If the user tries to do something nonsensical, such as checking in an item that is not checked out, they are notified with an error dialog

- The program compiles

- The program follows good coding conventions and design guidelines

- The program runs

Attachment:- TranTuanpPersonalLendingLibrary.zip

Reference no: EM131585857

Questions Cloud

Define natural monopoly : What does the size of the market have to do with whether an industry is a natural monopoly
Is there a way to visit all observation stations in one trip : IGS, an international group of scientists, proposes that a network of canals on Mars be dredged in preparation for irrigation and terraforming.
What are the main characteristics of a competitive market : In your own words what are the main characteristics of a competitive market
Establish relationships : Should a new business network with local suppliers before or after the business opens to establish relationships and see what trade credit might be available
Rewrite all of the methods in the library class : Improve our personal lending library tool by (1) adding the ability to delete items from the library - shows a sample run of this program.
What approach would you use for treating this client : Imagine that you are working with a client who has been diagnosed with obsessive compulsive disorder. What approach would you use for treating this client?
What were each of their views of the causes recessions : What were each of their views of the causes recessions and solutions to fixing them? In each of their views, what place did government have to improve markets
How does this affect the efficiency of the market : Suppose that in a market for the handbags the equilibrium price is $40, How does this affect the efficiency of the market
What is current ratio and quick ratio : What is current ratio and quick ratio?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a program that displays a countdown first

Write a program that displays a countdown first, and then displays the position and velocity of an object for every second it drops, as long as it is above 500 feet

  Please write the code in java nbsprecursionimplement a

please write the code in java nbsprecursionimplement a subsetgenerator that generates all subsets of the characters of

  Create your own green color for the leaves

Create your own green color for the leaves and display a solid green ellipse filled with your green color whose center is at the beginning of the drag and put a brown rectangle below it as the trunk of the tree.

  Specify, design and implement a class

Specify, design and implement a class that can be used to hold information about a musical note. Test it with an appropriate driver program.

  Java program that prompts the user to input three numbers

Need a java program that prompts the user to input three numbers. This program should then output the numbers in nondescending order

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Perform multiplication function using the calculator

Perform addition function using the calculator graphical user interface. Write code to add a plus (+) button in calculator graphical interface

  Design a class named linearequation

(Algebra: 2 X 2 linear equations) Design a class named LinearEquation for a 2 X 2 system of linear equations.

  Program to track hourly employee arrival and departure time

THE JAVA SOURCE CODEA company hires you to write a program to track hourly employee arrival and departure times from work. In essence, you are tasked to make an online time clock. The time clock shall keep a history of an employee’s hours for a two-w..

  The objective is to implement a menu-based system for bank

the objective is to implement a menu-based system for bank accounts in order to simulate a very simple banking system.

  Write java program which will permit user to make selection

Write the Java Program which will permit the user to make selection. You will present user with two options to perform, then you will perform action selected by user.

  How should ijvm be modified to make best use of instructions

On the full JVM machine, there are special 1-byte opcodes for loading locals 0 through 3 onto the stack instead of using the general ILOAD instruction. How should IJVM be modified to make the best use of these instructions?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd