Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Linked List Approach, produce the file \"p3artists.txt\" after updating th

ID: 3864873 • Letter: U

Question

Using Linked List Approach, produce the file "p3artists.txt" after updating the input file "p1artists.txt" using "p2changes.txt"

Programming Steps: (Please screenshot or copy the output after answering) (Sample output below)

1) Construct a class named "p3a.java" that does the following.

1) Use the Linked approach to update “p1artists.txt” through reading “p2changes.txt” to produce output file “p3artists.txt”.

2) "p1artists.txt" has the Artist ID and Artists name, which are going to be updated (either added or deleted) using the file "p2changes.txt" to produce the output file "p3artists.txt".

If A : Add record using linked list

If D : Delete record using linked list

3) Use System.nanoTime() to find the time spent on this approach.

Required Files:

p2changes.txt:

A   Reed
A   Rissman
D   11
A   Rogers
A   Roman
A   Schenck
D   16
A   Scherzel
A   Scholder
D   21
D   31
A   Senior
D   41
A   Shenal
A   Statom
A   Swartz
A   Tidwell
D   46
A   Turrell
A   Udinotti
A   Van Coller
A   Waid
D   51
A   Werner
A   Wittner
D   55
A   Wright
A   Xie
A   Yasami
A   Zischke

p1artists.txt:

1   Acconci
2   Ames
3   Aserty
4   Baron
5   Battenberg
6   Bindner
7   Blain
8   Blum
9   Budd
10   Cardenas
11   Carpenter
12   Chico
13   Colvin
14   Cox
15   Cridler
16   Curtis
17   Dawson
18   DiGrigoro
19   Dill
20   Edwards
21   Fleming
22   Fratt
23   Garber
24   Garin
25   Giama
26   Gilhooly
27   Gonzales
28   Guys
29   Hamend
30   Higgins
31   Hofmann
32   Ibe
33   Indiana
34   Ingraham
35   Irvin
36   Kerrihard
37   Kollasch
38   Kritz
39   Lerman
40   Long
41   Lowney
42   Lundquist
43   Lutes
44   Maglich
45   McGraw
46   McIver
47   Meglech
48   Metz
49   Miller
50   Mogan
51   Motherwell
52   Novarre
53   Odiezma
54   Ortega
55   Parker
56   Penn
57   Pierobon
58   Prinzen
59   Quiroz
60   Rath
61   Reed
62   Rissman
63   Rogers
64   Roman
65   Schenck
66   Scherzel
67   Scholder
68   Senior
69   Shenal
70   Statom
71   Swartz
72   Tidwell
73   Turrell
74   Udinotti
75   Van Coller
76   Waid
77   Werner
78   Wittner
79   Wright
80   Xie
81   Yasami
82   Zischke

Sample output: (As seen below, the records with D next to it are deleted, and A are added)

1   Acconci
2   Ames
3   Aserty
4   Baron
5   Battenberg
6   Bindner
7   Blain
8   Blum
9   Budd
10   Cardenas
12   Chico
13   Colvin
14   Cox
15   Cridler
17   Dawson
18   DiGrigoro
19   Dill
20   Edwards
22   Fratt
23   Garber
24   Garin
25   Giama
26   Gilhooly
27   Gonzales
28   Guys
29   Hamend
30   Higgins
32   Ibe
33   Indiana
34   Ingraham
35   Irvin
36   Kerrihard
37   Kollasch
38   Kritz
39   Lerman
40   Long
42   Lundquist
43   Lutes
44   Maglich
45   McGraw
47   Meglech
48   Metz
49   Miller
50   Mogan
52   Novarre
53   Odiezma
54   Ortega
56   Penn
57   Pierobon
58   Prinzen
59   Quiroz
60   Rath
61   Reed
62   Rissman
63   Rogers
64   Roman
65   Schenck
66   Scherzel
67   Scholder
68   Senior
69   Shenal
70   Statom
71   Swartz
72   Tidwell
73   Turrell
74   Udinotti
75   Van Coller
76   Waid
77   Werner
78   Wittner
79   Wright
80   Xie
81   Yasami
82   Zischke
82   Reed
83   Rissman
84   Rogers
85   Roman
86   Schenck
87   Scherzel
88   Scholder
89   Senior
90   Shenal
91   Statom
92   Swartz
93   Tidwell
94   Turrell
95   Udinotti
96   Van Coller
97   Waid
98   Werner
99   Wittner
100   Wright
101   Xie
102   Yasami
103   Zischke

Required Classes:

Artist.java:

public class Artist implements java.lang.Comparable<Artist> {
// Instance variables
private int artistID; // id of artist
private String artistName; // name of artist
private Art art;

/**
* Constructor
*
* @param name
* @param number
*/
Artist(String name, int number) {
this.artistID = number;
this.artistName = name;
}

/**
* Constructor
*
* @param artistID
* @param artistName
* @param art
*/
public Artist(int artistID, String artistName, Art art) {
this.artistID = artistID;
this.artistName = artistName;
this.art = art;
}

/**
* return the artistName
*
* @return
*/
public String getArtistName() {
return artistName;
}

/**
* set the artistName
*
* @param artistName
*/
public void setArtistName(String artistName) {
this.artistName = artistName;
}

/**
* return the artistId
*
* @return
*/
public int getArtistID() {
return artistID;
}

/**
* set the artistId
*
* @param artistId
*/
public void setArtistID(int artistId) {
this.artistID = artistId;
}

/**
* @return the art
*/
public Art getArt() {
return art;
}

/**
* @param art
* the art to set
*/
public void setArt(Art art) {
this.art = art;
}

public int compareTo(Artist o) {
return this.getArt().compareTo(o.getArt());
}

/**
* toString method
*/
public String toString() {
return String.format("%-9d %-20s", this.artistID, this.artistName);
}
}

Art.java:

public class Art implements java.lang.Comparable<Art> {

// Instance variables
private int artID;
private String artTitle;
private int appraisedValue;

/**
* Constructor
*
* @param artID
* - art id
* @param artTitle
* - title of the art
* @param appraisedValue
* - value
*/
public Art(int artID, String artTitle, int appraisedValue) {
this.artID = artID;
this.artTitle = artTitle;
this.appraisedValue = appraisedValue;
}

/**
* @return the artID
*/
public int getArtID() {
return artID;
}

/**
* @return the artTitle
*/
public String getArtTitle() {
return artTitle;
}

/**
* @return the appraisedValue
*/
public int getAppraisedValue() {
return appraisedValue;
}

/**
* @param artID
* the artID to set
*/
public void setArtID(int artID) {
this.artID = artID;
}

/**
* @param artTitle
* the artTitle to set
*/
public void setArtTitle(String artTitle) {
this.artTitle = artTitle;
}

/**
* @param appraisedValue
* the appraisedValue to set
*/
public void setAppraisedValue(int appraisedValue) {
this.appraisedValue = appraisedValue;
}
  
public int compareTo(Art o) {
return (this.getArtID() - o.getArtID());
}

@Override
public String toString() {
return String.format("%-6d %-25s %d", artID, artTitle, appraisedValue);
}

}

LinkedBag.java: (if needed)

LinkedBag.java:

Explanation / Answer

public class LinkList { private Node first = null; public void insertFirst(int data) { Node n = new Node(data); n.next = first; first = n; } public Node deleteFirst() { Node temp = first; first = first.next; return temp; } public void displayList() { Node current = first; while (current != null) { current.displayNode(); current = current.next; } } public boolean isEmpty() { return (first == null); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote