Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction: Inventory of an online shopping mall is very dynamic.Some items come and go in no time.So, in this project we are going to simulate

Introduction:

Inventory of an online shopping mall is very dynamic.Some items come and go in no time.So, in this project we are going to simulate the dynamic state of an inventory.In order to save time, we are going to use a file called p2changes.txt.The file, tab delimited, contains two types of record and each record contains two fields as following:

Action

ID or Name

A or a

Artist Name

D or d

Artist ID

Where A means Add and D means Delete.

Details:

Description:

To help you understand various ways to maintain a set of data, we are going to use 3 different ways to manage data while it is being changed.

Assume that we start with the following records (Table-1):

ArtistID

Artist Name

1

Acconci

2

Ames

3

Aserty

4

Baron

5

Battenberg

Later on, the file needs to be updated according to the following (Table-2):

Action

ArtistID

Artist Name

A

6

Bindner

A

7

Blain

D

2

A

8

Blum

D

4

A

9

Budd

D

8

(NOTE: For Add, the Artist ID is assigned by the program. In this case, we simply use the number continuous from the last ID number. The number that has been deleted is not reassigned.)

Using Array structure the 3 different approaches will end up with the following:

(1. Without Gap)

ArtistID

Artist Name

1

Acconci

3

Aserty

5

Battenberg

6

Bindner

7

Blain

9

Budd

(2. Use Delete Field)

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)

ArtistID

Artist Name

Next

1

Acconci

3

2

Ames

0

3

Aserty

5

4

Baron

0

5

Battenberg

6

6

Bindner

7

7

Blain

9

8

Blum

0

9

Budd

-1

Assignment:

Use Excel to trace every change that Table-2 makes to Tble-1. Name this file p2transition (Your name).xlsx.

Write a program that uses the 3 different approaches mentioned above to produce the updated version of p1artists.txt through the use of p2changes.txt. Lets call the output files p2artists2a.txt, p2artists2b.txt, and p2artistis2c.txt. Compare the files and they should be same.

Use System.nanoTime() as following to find the time spent on each approach:

long startTime = System.nanoTime();

methodToTime(); //This is your code to be measured.

//This should include the time to print the result.

long endTime = System.nanoTime();

long duration = (endTime - startTime);

You are encouraged to try System.currentTimeMillis() to see the difference.

Write a summary to compare the 3 different approaches and then combine the result from the next project. Submit the report with project 3.

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

Students also viewed these Databases questions

Question

mple 10. Determine d dx S 0 t dt.

Answered: 1 week ago