Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

III. Step 3: In this step, Using Doubly Linked List you are going to sort the Artworks for each artist so that his artworks will

III. Step 3: In this step, Using Doubly Linked List you are going to sort the Artworks for each artist so that his artworks will be on ascending order on artID.

A. What to Do: 1. Modify your ArtistNode.java as following: i. Construct add method so that the new instance of ArtNode can be added in ascending order on artID. Hints: You will need to consider 4 different cases for a new Node that can be 1. the only node of the list 2. The last(but not the only) node of the list 3. The first(but not the only) node of the list 4. In the middle of the list

2. Construct MyArtWorks.java:

- Contains: 1. "artists" - An instance of MyArtistNodes that reads input file into the list.

2. Constructor: - Accepts the input file Name so that the entire entries from the file will be constructed.

3. print() method: - To write it to the output file. (This method will be called later in Exam4Step3.java to write to the file)

3. Modify MyArtworks.java with the following modifications: 1. Pass "exam4Artists.txt" when making an instance of MyArtists (let's call it "myArtists") 2. Whenever you read an ArtWork, you will use the map to locate the Artist to whom ArtWork should belong.

3. Write Exam4Step3.java to test your program: 1. Pass "exam4Arts.txt" when making an instance of MyArtWorks. 2. Construct a print method to write the required output to the output file "out3.txt".

Sample Output: (out3.txt) 1 Acconci 3 18800.00 1038 Spring Flowers 1 800.00 1050 Cattle Ranch 1 10000.00 1103 Trail End 1 8000.00 2 Budd 3 35544.00 1042 Coffee on the Trail 2 800.00 1086 Untitled (desert Landscape) 2 10000.00 1101 The Red Door 2 8000.00 31 Acconci 12 284975.00 1010 Untitled (land with adobe) 3 800.00 1013 Superstitions 3 78000.00 1103 Trail End 1 8000.00

And so on... for other Artists

Required Files:

exam4Arts.txt:

1038 Spring Flowers 1 800 1050 Cattle Ranch 1 10000 1103 Trail End 1 8000 1042 Coffee on the Trail 2 7544 1013 Superstitions 3 78000 1021 Bead Wall 3 14000 1034 Beaver Pole Jumble 3 28000 1063 Asleep in the Garden 3 110000 1070 Beginnings 4 27500 1036 Blackhawk 5 25500 1017 Brittlecone 6 1300 1053 Blue Eyed Indian 6 40000 1056 Cavalry Is Coming 6 1900 1075 Western Boots and Spurs 6 6000 1077 Bull Riding 6 5200 1049 Buttercup with Red Lip 7 400 1018 Mountain Scene 8 2500 1055 Starlit Evening 9 9500 1096 Ceremonial Sticks 10 15000 1037 Floating World 7 2350 1109 Friends 8 16000 1084 Crossing the Platt River 9 2200 1072 Funnel 10 4500 1032 Rising Sun 7 2000 1060 Story Sticks 8 650 1044 Mexican Fiesta 9 14000 1047 Medicine Man 10 2500 1024 Spirit and Nature 7 592 1067 Owl in Flight 8 7000 1001 Red Rock Mountain 9 18000 1028 Tired Cowboy 10 4700 1054 Snake Charmer 7 4500 1068 Moonlight 8 9750 1069 Renaissance 9 5500 1113 Shadow House 10 5500 1114 Storytelling at the Campfire 7 18000 1064 Spirit Columns 8 7000 1002 Offerings 9 10000 1089 Life Lessons 10 4125 1091 Stone Palette 7 11500 1074 Storm on the Rise 8 8000 1098 Sweet Project 9 592 1048 Comfy Chair 10 800 1101 The Red Door 2 10000 1080 The Dust Behind 3 18000 1058 The Gathering 3 250 1019 The White Heart 3 9300 1095 The Spirit 3 20000 1079 Carrying the Mail 4 8000 1093 Antelopes 5 12500 1110 Three Sisters 6 6500 1085 Traces 6 20000 1004 Seeking Shelter 6 52000 1016 Untitled 6 6000 1026 Untitled (couple) 7 4000 1057 Untitled 8 4500 1086 Untitled (desert landscape) 2 18000 1025 Profile of a Woman 3 625 1022 The Cowboy 3 4200 1104 Untitled 3 1800 1010 Untitled (land with adobe) 3 800 1111 Untitled (man and crucifix) 4 3200 1020 Untitled (Man holding coat) 5 3000 1012 Man on Horseback 6 8000 1097 Untitled (Sea) 6 2800 1066 Untitled (still life) 6 19500 1033 Untitled (Woman abstract) 6 2500 1061 Untitled Mural 7 3520 1071 Ride the Rapids 8 300

ArtistNode.java:

public class ArtistNode extends Artist { private ArtNode firstNode; private ArtNode lastNode; int totalEntries; double totalValue; public ArtistNode(String artistName, int artistID) { super(artistName,artistID); this.firstNode = null; this.lastNode = null; totalEntries = 0; totalValue = 0; } public int getTotalEntries() { return totalEntries; }

/** * return the artistId * * @return */ public double getTotalValue() { return totalValue; }

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

/** * toString method */ public String toString() { return String.format(Artist.getArtistName() + " " + ArtistNode.getArtistID() + "\t, %-9d ,\t%-20s", this.totalEntries, this.totalValue); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

Explain the factors influencing wage and salary administration.

Answered: 1 week ago

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago