Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a Java application which implements an application for a store chain that has three types of stores which are Book, Music, and Movie stores.

Develop a Java application which implements an application for a store chain that has three types of stores which are Book, Music, and Movie stores.

Your application should have an Item abstract class which should be extended by the Book and Multimedia classes. Item class has abstract priceAfterTax method, you need to implement this method in derived classes. Multimedia class is a superclass for Music and Movie classes. Your project should also include the IPromotion interface, which should be implemented by Book and Movie classes. Also, your application should have the Lookup class (which is provided in part in this document). Lookup class works as the datastore: it contains all the various items available - books, movies, music items - as well as the list of users.

In your main class you should initiate a lookup object in the main method. You also need to include a User class which has the fields and the methods shown for that class in the class diagram. User class has a library of items; once a user downloads or purchases any item, you should add this item to that users library. If the user just plays music or watches a movie you should not add this item to the users library.

Hints:

Most of your classes should override the toString method. So, to print store items you should use the toString method.

To calculate promotionValue (i.e. price after promotionRate is applied), you need to implement this equation (price = price price*promotionRate).

PromotionRate for book items is 0.8, and for movie items is 0.5. There is no promotionRate for music items.

To calculate total price including taxes, you need to implement this equation (price = price + price*taxRate).

TaxRate for book items is 0.2, taxRate for multimedia items is 0.25.

The interface IPromotion and part of the code for class Lookup are provided below.

public interface IPromotion {

/**

* This method is called by the getPrice methods for Book

* and Movie classes.

* @return promotion value which is 0.8 for Book item

* and 0.5 for movie item

*/

public double salesPromotion();

}

public class Lookup{

public User[] userList;

public Item[] storeItemList;

public Lookup() {

userList = createUsers();

storeItemList = loadItems();

}

/**

*

* @param userName

* @param password

* @return Return the user object it it exist

*/

public User checkLoginAuth(String userName, String password) {

}

public User[] getUserList() {

}

public void setUserList(User[] userList) {

}

public Item[] getStoreItemList() {

}

public void setStoreItemList(Item[] mStoreItemList) {

}

/**

* This method adds two users to the user list,

* "You should not change these users, but you

* can add new users

*/

public User[] createUsers() {

User[] list = new User[2];

list[0] = new User(1, "sara", "123");

list[1] = new User(2, "adam", "321");

return list;

}

/**

* This method load data to the item list, this list has all the

* items in your application "You should not change these data

* but you can add new items".

*

*/

public Item[] loadItems() {

Item[] itemList = new Item[5];

String[] languages = new String[2];

languages[0] = "English";

languages[1] = "Arabic";

itemList[0] = new Book(1, "Engineering Analysis with SOLIDWORKS Simulation 2017",

"SDC Publications", "\tEngineering Analysis with SOLIDWORKS Simulation 2017"

+ " \tgoes beyond the standard software manual."

+ " \tIts unique approach concurrently introduces you to the SOLIDWORKS"

+ " \tSimulation 2017 software and the fundamentals of Finite Element Analysis"

+ " \t(FEA) through hands-on exercises. A number of projects are presented"

+ " \tusing commonly used parts to illustrate the analysis features of "

+ " \tSOLIDWORKS Simulation. Each chapter is designed to build on the skills, "

+ " \texperiences and understanding gained from the previous chapters.",

false, 10, 578, "Paul Kurowski", "9781630570767", languages);

itemList[1] = new Book(2, "SQL Queries for Mere Mortals",

"Addison-Wesley Professional",

"\tSQL Queries for Mere Mortals has earned worldwide praise "

+ " \tas the clearest, simplest tutorial on writing effective SQL queries."

+ " \tThe authors have updated this hands-on classic to reflect new "

+ " \tSQL standards and database applications and teach valuable new techniques." +

" \tStep by step, John L. Viescas and Michael J. Hernandez guide you through "

+ " \tcreating reliable queries for virtually any modern SQL-based database. "

+ " \tThey demystify all aspects of SQL query writing, from simple data selection"

+ " \tand filtering to joining multiple tables and modifying sets of data.",

true, 0, 792, "John L. ViescasMichael J. Hernandez", "9780133824841", languages);

itemList[2] = new Movie(101, "Smurfs: The Lost Village", "Dupuis",

"\tFully animated with new characters looking like the original"

+ " \tPeyo's animation. This film will answer all of the questions "

+ " \tof the Smurfs such as \"Why do the Smurfs live in "

+ " \tsara mushrooms?\" and \"Why don't the Smurfs wear shirts?\"",

false, 20, 89, "English", "Animation");

itemList[3] = new Movie(101, "Black Panther", "Ryan Coogler",

"\tAfter the death of his father, the king of Wakanda,"

+ " \tyoung TChalla returns home to the isolated high-tech "

+ " \tAfrican nation to succeed to the throne and take his rightful"

+ " \tplace as king. But when a powerful enemy reappears,"

+ " \tTChallas mettle as king and Black Panther is tested when"

+ " \thes drawn into a formidable conflict that puts the fate of"

+ " \tWakanda and the entire world at risk.",

false, 20, 89, "English", "Action & Adventure");

itemList[4] = new Music(201,

"Le rossignol", "Modest Mussorgsky",

"\ 1-The Nutcracker (Suite), Op.71a: 3. Waltz of the Flowers" +

"\ \ 2- The Nutcracker (Suite), Op.71a: 2b. Dance of the Sugar Plum Fairy"+

"\ \ 3- Prelude in C Major, Op. 12, No. 7",

false, 2, 4, "MP3", "Russian Album");

return itemList;

}

/**

* Print Movie list from storeItemList

*/

public void printMovieList() {

}

/**

* Print Books list from storeItemList

*/

public void printBookList() {

}

/**

* Print Music list from storeItemList

*/

public void printMusicList() {

}

/**

* This method searches for the item by its key

* and then return the item object if the item exist

* else return null

*/

public Item getItemById(int key) {

}

}

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_2

Step: 3

blur-text-image_3

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

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago