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

in java program is that anybody help me to complete this assignment read the the

ID: 3668105 • Letter: I

Question

in java program

is that anybody help me to complete this assignment read the the file using the array index p1artists.txt in java
Artist ID Artist Name
1 Acconci
2 Ames
3 Aserty
4 Baron
5 Battenberg

Then using the add method to enter the row 6 and 7

here is the sample of output p2artists2a.txt”

Artist ID Artist Name
1 Acconci
2 Ames
3 Aserty
4 Baron
5 Battenberg
6 Bindner
7 Blain

then using the delete method to delete the Artist ID Artist Name 2

Here is the sample of output p2artists2b.txt

Artist ID Artist Name
1 Acconci
3 Aserty
4 Baron
5 Battenberg
6 Bindner
7 Blain

Here is the sample of final output file using A for add and D for delete the file name p2artistis2c.txt”

Action ArtistID Artist Name
A 6 Bindner
A 7 Blain
D 2
A 8 Blum
D 4
A 9 Budd
D 8

(2. Use Delete Field) Here is the sample of final output file using F for not change and T for delete the file name p2artistis3c.txt”

ArtistID Artist Name Delete

1 Acconci F

2 Ames T

3 Aserty F

4 Baron T

5 Battenberg F

6 Bindner F

7 Blain F

8 Blum T

9 Budd F

(3. Use Next Field)  Here is the sample of final output file using the file name p2artistis3c.txt”

ArtistID Artist Name Next

1 Acconci 3

2 Ames 0

Aserty 5

4 Baron 0

5 Battenberg 6

6 Bindner 7

7 Blain 9

8 Blum 0

9 Budd -1

(0 means the record has been deleted) and (-1 is the end of the link)

Explanation / Answer

//package ProjectTest2;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;


*/
public class HelloWorld
{
    int numberOfEntries; //entry total

    public static void main(String[] args)
    {
        ArrayList<String> entryArr = new ArrayList<>(); // array list for adding and removing
        String[] idArray = new String[100];


        String[] artistArray;
        int myIndexNum = 0; // used to print changed index according to add or delete
        boolean deleteField = false;
        int indexIncrement = 1; //initialize
        int[] indexArray = new int[indexIncrement]; //load index to be compared
        String[] artistCompareArr = new String[8];

        // Method calls and timers
        long startTimeAddDel = System.nanoTime();
        changeFileA(1, "name");
        long endTimeAddDel = System.nanoTime();
        long durationAddDel = endTimeAddDel-startTimeAddDel;
        changeFileB(2, "name2");
        changeFileC(3, "name3");

        System.out.println("Add or delete array completed in: " + durationAddDel);

        /**TODO:Split integer into an array, use this integer to compare to another index array
         * This index should be compared after add or delete is found then...
         * if (index[0].equals(index2[0]))
         * print result with id name true or false
         * This comparison can show whether a marked index's integer matches the other
         * created index array
         */


        /**Starting file step 1 */
        try
        {
            Scanner input = new Scanner(new File("p2artists.txt"));
            File myFile = new File("p2artists2b3.txt");
            PrintWriter output = new PrintWriter(myFile);
            int i = 0; // loop counter
            while (input.hasNext())
            {
                try
                {
                    String nameName = input.nextLine();
                    entryArr.add(nameName);
                    idArray[i] = nameName;
                    i++; // increment counter
                    myIndexNum += 1; // sum index number to be used for printing
                }
                catch (InputMismatchException e)
                {
                    input.next();
                } // end catch
            } // end while loop
            input.close(); // close Scanner
            output.close();
        } // end try
        catch (FileNotFoundException e)
        {
            System.out.println("No such file was found");
        } // end catch

        /**Creates an array that holds the values for adding and deleting
         * Uses array list utils to append entries
         * TODO: Add deletion field
         */

        /**Open changes file and load up arrays to compare */
        try
        {
            Scanner input = new Scanner(new File("p2changes.txt"));
            int index =0;
            while (input.hasNext())
            {
                String[] addOrDelete = input.nextLine().split(" ");
                if (addOrDelete[0].equals("A"))
                {
                    myIndexNum++; // increment to use as index
                    entryArr.add(myIndexNum + " " + addOrDelete[1]); //add new array elements
                    //idArray[index] = myIndexNum + " " + addOrDelete[1];
                }
                //Tried to implement delete conditional statement for arrayList
                if (addOrDelete[0].equals("D")) {
                    artistCompareArr[index] = (addOrDelete[1]); //index numbers to be deleted
                    index++;
                }

            }
            input.close();
            //output.close();
        }
        catch (FileNotFoundException e)
        {
            System.out.println();
        } // end catch


        /**Compare index for deletion*/
        /**Ideas: Get a third array that holds only index then compare that with artistCompareArr*/

            int indexCounter = 0; //count through array, if index+1 = artistCompareArr remove
            for (int index = 0; index < entryArr.size(); index++)
            {

                if (entryArr.get(indexCounter).equals(artistCompareArr)) {

                }

            }


        try
        {
            File myFile = new File("p2artists2b.txt");
            PrintWriter output = new PrintWriter(myFile);

            for (int i = 0; i < entryArr.size(); i++)
                output.println(entryArr.get(i));
            output.close(); // close printWriter
        } // end try
        catch (FileNotFoundException e)
        {
            System.out.println();
        } // end catch

        entryArr.toArray(idArray);
        for (int index = 0; index < idArray.length; index++)
            System.out.println(idArray[index]);
    }

    //TODO: Create array without gap
    public static void changeFileA(int id, String name)
    {
        //STUB
        System.out.println(id + " " + name);


    }

    //TODO: Create array with delete field
    //Adds delete field, displaying true or false as a new parameter
    public static void changeFileB(int id, String name)
    {
        //STUB
        System.out.println(id + " " + name);
    }

    //TODO: Create array with next field
    //Next field points to the next available point in an array (1 points to 3 if index 2 is null)
    public static void changeFileC(int id, String name)
    {
        //STUB
        System.out.println(id + " " + name);
    }
}


plartists.java
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

plarts.java
1001   Red Rock Mountain   50   18000
1002   Offerings    52   10000
1003   Spring Flowers   12   2400
1004   Seeking Shelter   64   52000
1005   The Hang   18   8000
1006   House Remembered   32   700
1007   Homage to the Ancestors   82   1200
1008   End of the Path   26   1900
1009   Amen   28   3000
1010   Untitled (land with adobe)   71   800
1011   Eve   19   975
1012   Man on Horseback   74   8000
1013   Superstitions   3   78000
1014   Plenty   45   500
1015   Punch   46   10000
1016   Untitled   65   6000
1017   Brittlecone   6   1300
1018   Mountain Scene   8   2500
1019   The White Heart   61   9300
1020   Untitled (Man holding coat)   73   3000
1021   Bead Wall   3   14000
1022   The Cowboy   69   4200
1023   Shooting the Rapids   47   1300
1024   Spirit and Nature   48   592
1025   Profile of a Woman   68   625
1026   Untitled (couple)   66   4000
1027   Mountain Climber   47   4700
1028   Tired Cowboy   50   4700
1029   Horseshoe Falls   31   15000
1030   Ash Bench   28   13000
1031   Inside/Out   34   3500
1032   Rising Sun   42   2000
1033   Untitled (Woman abstract)   77   2500
1034   Beaver Pole Jumble   3   28000
1035   Nature/Nurture   47   1300
1036   Blackhawk   5   25500
1037   Floating World   21   2350
1038   Spring Flowers   1   800
1039   Treachery   14   20000
1040   Night on the Praire   47   1300
1041   Night Version   29   3800
1042   Coffee on the Trail   2   7544
1043   Creosote Bushes   28   18000
1044   Mexican Fiesta   43   14000
1045   Leaf Patterns   38   2100
1046   Immediate Gratification   33   1500
1047   Medicine Man   44   2500
1048   Comfy Chair   57   800
1049   Buttercup with Red Lip   7   400
1050   Cattle Ranch   1   10000
1051   Night Version   36   7000
1052   American Rodeo   16   3500
1053   Blue Eyed Indian   6   40000
1054   Snake Charmer   50   4500
1055   Starlit Evening   9   9500
1056   Cavalry Is Coming   6   1900
1057   Untitled   66   4500
1058   The Gathering   60   250
1059   Dwelling   17   16000
1060   Story Sticks   42   650
1061   Untitled Mural   78   3520
1062   Cowboy and Saddle   41   18000
1063   Asleep in the Garden   3   110000
1064   Spirit Columns   51   7000
1065   Moonlite    47   1300
1066   Untitled (still life)   76   19500
1067   Owl in Flight   49   7000
1068   Moonlight   50   9750
1069   Renaissance   50   5500
1070   Beginnings   4   27500
1071   Ride the Rapids   79   300
1072   Funnel   24   4500
1073   Dancing in the Light   15   4000
1074   Storm on the Rise   55   8000
1075   Western Boots and Spurs   6   6000
1076   Ride the Bronco   79   1500
1077   Bull Riding   6   5200
1078   Chuckwagon   28   32000
1079   Carrying the Mail   62   8000
1080   The Dust Behind   59   18000
1081   Coming Under Fire   13   650
1082   Spring Flowers   29   20000
1083   Untitled   64   2500
1084   Crossing the Platt River   23   2200
1085   Traces   63   20000
1086   Untitled (desert landscape)   67   18000
1087   Three Woman   81   20000
1088   Lessons   37   3700
1089   Life Lessons   53   4125
1090   Off the Grid   11   8000
1091   Stone Palette   54   11500
1092   Dressing Up   47   1300
1093   Antelopes    62   12500
1094   Life Is Sweet   39   25000
1095   The Spirit   61   20000
1096   Ceremonial Sticks   10   15000
1097   Untitled (Sea)   75   2800
1098   Sweet Project   56   592
1099   Watch That Rattler   20   900
1100   Hungry Cowboys   38   750
1101   The Red Door   58   10000
1102   Crying Hats   14   10000
1103   Trail End   1   8000
1104   Untitled    70   1800
1105   Meteor Show   80   10000
1106   Horse Corral   40   12500
1107   Striking It Rich   35   1750
1108   Untitled Mural   77   400
1109   Friends   22   16000
1110   Three Sisters   62   6500
1111   Untitled (man and crucifix)   72   3200
1112   Dark Canyon   27   8000
1113   Shadow House   50   5500
1114   Storytelling at the Campfire   50   18000
1115   Starry Night   25   8500
1116   Apache Warrior   30   23000

p2artists.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

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

sample output                                                                                                                             
1       name                                                                                                                                                
1       name                                                                                                                                                
1       name                                                                                                                                                
2       name2                                                                                                                                               
3       name3                                                                                                                                               
Add or delete array completed in: 318047                                                                                                                    
2       name2                                                                                                                                               
3       name3                                                                                                                                               
Add or delete array completed in: 318047                                                                                                                    
2       name2                                                                                                                                               
                                                                                                                                              
Add or delete array completed in: 318047                                                                                                                    
2       name2                                                                                                                                               
3       name3                                                                                                                                               
Add or delete array completed in: 318047                                                                                                                    
2       name2                                                                                                                                               
3       name3                                                                                                                                               
Add or delete array completed in: 318047                                                                                                                    
1       Acconci1        Acconci1        Acconci                                                                                                             
2       Ames                                                                                                                                                
3       Aserty                                                                                                                                              
4       Baron                                                                                                                                               
5       Battenberg                                                                                                                                          
6       Bindner                                                                                                                                             
7       Blain                                                                                                                                               
2       Ames