
Java coding
- or -
Post a project like this877
$10
- Posted:
- Proposals: 5
- Remote
- #3745924
- Awarded
Description
Experience Level: Entry
(hint: a lot of this is just using the right incantations for the libraries we are using, so it is probably simpler to cannibalize chunks of the example code but make them work for your classes, instead of starting from scratch)
Create a class Song that stores a name, an artist, a length in minutes, and a number of plays.
Make Song Serializable, but make the number of plays transient.
In a class with a main called FirstMain, create a List of at least 10 songs with varying info.
Using a JFileChooser, let the user choose a location and file name to save the List to.
Since List is also serializable, you can serialize the whole list with one call to writeObject, and in that case you don't need an extra null
Add another class SecondMain with a main (in the same package). In this main, use a JFileChooser to let the user choose a file of serialized Songs to read into an List and then print them. Test that this works on the file created by FirstMain
(note: you can't check instanceof on List but you can check on List; technically we should first cast the object we get to a general list, and then check its contents to see if it has songs, but for the purposes of this assignment you can cast straight to List)
[EC] Instead of serializing and deserializing the whole list as one object, serialize the Songs one by one (all to the same file) and write a null to the end of the file to support looping when you read it later.
[EC] To create the original List of Songs, instead of hardcoding them, create a CSV file of Songs called songs.csv (at the top of your project directory) and read this file into FirstMain.
Create a class Song that stores a name, an artist, a length in minutes, and a number of plays.
Make Song Serializable, but make the number of plays transient.
In a class with a main called FirstMain, create a List of at least 10 songs with varying info.
Using a JFileChooser, let the user choose a location and file name to save the List to.
Since List is also serializable, you can serialize the whole list with one call to writeObject, and in that case you don't need an extra null
Add another class SecondMain with a main (in the same package). In this main, use a JFileChooser to let the user choose a file of serialized Songs to read into an List and then print them. Test that this works on the file created by FirstMain
(note: you can't check instanceof on List but you can check on List; technically we should first cast the object we get to a general list, and then check its contents to see if it has songs, but for the purposes of this assignment you can cast straight to List)
[EC] Instead of serializing and deserializing the whole list as one object, serialize the Songs one by one (all to the same file) and write a null to the end of the file to support looping when you read it later.
[EC] To create the original List of Songs, instead of hardcoding them, create a CSV file of Songs called songs.csv (at the top of your project directory) and read this file into FirstMain.

Yash P.
100% (9)Projects Completed
4
Freelancers worked with
2
Projects awarded
71%
Last project
6 Dec 2022
India
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies