Question
Using Linked list approach, read the files and (add or delete specified records using linked list) and output the updated list to p3artists.txt file: Introduction:
Using Linked list approach, read the files and (add or delete specified records using linked list) and output the updated list to "p3artists.txt" file:
Introduction:
We continue with the Bag data structure. However, in this project we focus on the representation of the Bag structure using singular linked list as described in chapter 3 of your textbook. Please study the sample programs LinkedBag.java and LinkedBagDemo.java.
Part A.
Data Files: p1artists.txt and p2changes.txt.
Assignment:
1) Use the Linked approach to update p1artists.txt through p2changes.txt to produce p3artists.txt.
If A : Add record using linked list
If D : Delete record using linked list
2) Use System.nanoTime() to find the time spent on this approach
Artist.java:
public class Artist { private int artistID; //id of artist private String artistName; //name of artist Artist(int number, String name) { this.artistID = number; this.artistName = name; }
//return the artistName public String getArtistName() { return artistName; }
//set the artistName public void setArtistName(String artistName) { this.artistName = artistName; }
//return the artistId public int getArtistID() { return artistID; }
// set the artistId public void setArtistID(int artistId) { this.artistID = artistId; }
// toString method public String toString() { return this.artistID + "\t" + this.artistName; }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started