Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab: Develop program for an online store which sells dvds and honks (items). The store will have cart which will cantain the items the user

image text in transcribed

Lab: Develop program for an online store which sells dvds and honks (items). The store will have cart which will cantain the items the user wants to purchase and their prics. The inventory for hooks and dvds will be stored in twn separate bring arrays which will coatzin the names of the bonks and the names of the dvds. In addition, twa separate arys of type doubie wil heused to siore the price corespending to each it You will create the arrays and populare them with data ar the heginning of your program. This is how the aays will lnok 45.99 89.14 25.00 49.99 ds nom dwdsPrioes 9.99 24.99 1.99 24.99 Murtover, you will impl ment the cart as tao errays too. Thu first array is for he narnes uflhe items the user wishes to purchase (hks dvds). The sacond is for the earresponding prices You oan assume a maximum can size af Sitesia, the User cannet have mare than 5 items in their cart. Afleryuu create an initlize all the arays and aray liss, the prugram will thum display anumu for thousur by calling be mathod dLsplayNenu { } . Th' 1nethod will display the following Ire8 wt called *Wdicune to the Cormets Beoss snN DVDs Store Chooae from the following aptians 1- Brawse hecks inventory price loa ta high 2 - Browse DVDs sory price low to hiph - Adda honk to the cart s-Viow cart 5 -Checkout s - Exit sture Then, within loup, iftus user enters an optioc dat is not 1, 2, 3, 4, 5, 6,7 or 8. display the message This option is not acceptable" and loop hock :n redispay the menu. Car tinue in this mannar mil a coeet option is input Ir option 1 is entered, call the methed displaayswith the following sigzature: ta display the inverory, Also keep in mind that we want to disply the inventory in the arda of low to high-in terms of price. You can implement any sorting algorithm EXCEPT bubble surt) thst we talked sbout in clsss to sort toe arrays You shoald t pass the correct two srays and a stringDooks" or "DVDto the methedas shuwn abuve depunding cm which oplin gels selected. Thmethod should display be arrays ine leQowing format(the books and bar prices are used hereas the example; the same formatting applies to DVDs: Path to j*va Fythan If option 3 is seled, call the method gutitnbr the methud should ask thes tu unter the inventory number they wish to purchase (from the list in Option 1) and-l if dey wish to redisplny the menu and nnt select nn inventary. Then the methad will read the invemary mumber kd rerarn the numbx entened by the user. You can take the inventory number wiich gets rcturned and remove 1 rom il to r the correct index into the array, Use the index to retrieve the coree item and coresponding pre, and then aid them to the art array The abuve dicussion applies fur option 4 (and corrspondingly optiun 2) as well If option 5 is seletad, you can overload the diaplayh=aral > method (or crnale 1 separate method) to accept just the arrays and display thu cari cartenis similar tu tho way you have displayed the inventory. Here is what the outpur should loo like format-wise yoa ean call the getTotal0 etotoget the ent total, see option 6 below 43.99 421.99 I tho array lists are mpty display yurcart is emply lowed by the menu. If option 6 is selerred, call the method gutzot l which aocepts as input, the price array und returns the tutal by luoping uver prices and aiculating the total. XMake sure you also add an 8.25 tax to the tocal. Dispay the intal for the user and clear the array (se oprion 5 se an arhanced tor loopto iterse ove prices in his method and End tee totl. Ir option 7 is selecod, call the cleareays mehod and pass it the cagtItens snd prices arrays, In the method, you will clear the scTRys to remove all he ite wich bave bom added 10 can the ordur. Cuntinue this looping until opticm B is selucte. When eptiun is entered, end the prugram. Subcnit only your source cude .java file(sN!! U- Remember to cuament your code well

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

What ethical values play an important role in this case?

Answered: 1 week ago