![lilyella1004](/avatars/34712.jpg)
lilyella1004
05.07.2021 •
Computers and Technology
Create a script called retail_store.js. In this script code the following:
A. Class and Constructor Creation
RetailItem Class
Create a constructor function or ES6 class for a RetailItem object. The RetailItem object should store the following data in attributes: item description, units in inventory, and price.
CashRegister Class
Create a constructor function or ES6 class for a CashRegister object that will be used with the RetailItem class. The CashRegister object should be able to internally keep an array of RetailItem objects.
B. Methods to add
CashRegister Class
The class should have the following methods:
A method named purchaseItem that accepts a RetailItem object as an argument. Each time the purchaseItem method is called, the RetailItem object that is passed as an argument should be added to the list of retailItems the CashRegister contains.
A method named getTotal that returns the total price of all the RetailItem objects stored in the CashRegister objects internal list.
A method named showItems that writes the information about each retail item stored in the cash register to the console.
A method named clear that should clear CashRegister object’s internal list.
C. Test Program
After you have created the classes. Create three RetailItem objects and store the following data in them:
DescriptionUnits In InventoryPrice
Item #1Jacket1151.99
Item #2Jeans2136.99
Item #3Shirt3424.99
Store all three RetailItem objects in an array named "inventory"
Next, create a CashRegister object.
Add all the items to the CashRegister using the purchaseItem method. Display the total using the CashRegister getTotal method. Display all the items using the CashRegister showItems method.
Solved
Show answers
More tips
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
- H Health and Medicine Kinesiology: What is it and How Does it Work?...
- O Other How to Choose the Best Answer to Your Question on The Grand Question ?...
- L Leisure and Entertainment History of International Women s Day: When Did the Celebration of March 8th Begin?...
- S Style and Beauty Intimate Haircut: The Reasons, Popularity, and Risks...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
- F Family and Home Why Having Pets at Home is Good for Your Health...
- H Health and Medicine How to perform artificial respiration?...
Answers on questions: Computers and Technology
- C Computers and Technology By looking at the IP packets in your trace, answer these questions: 1. What are the IP addresses of your computer and the remote server...
- C Computers and Technology Develop a program that counts the number of occurrences of each character in a string, including letters, punctuations, and white spaces. Letters are case sensitive (‘T’ and ‘t’...
- B Business Which of the following, if any, are an example of post investment holdup? In your answer explain: what is the sunk, or stranded cost; what is the contract; was the contract breached;...
- M Mathematics The Walt Disney Company, the production studio behind the Marvel Cinematic Universe, is trying to find the best release date for their new super hero movie. They are hesitating...
- H History List 3 things natural barriers china has...
- E English She will make dinner when she. home A gets B gets to C will get D is getting...
- H History The governor of New Netherland who surrendered to the English was...
- M Mathematics Lee is a teacher at a local high school who wanted to assess whether or not dogs physically resemble their owners enough for people to be able to correctly match a dog to their...
- E English What are the correlative conjunctions in this sentence? Select all that apply. We can either go to the movies or to the skating rink. Either Movies Or Skating rink...
- M Mathematics One company buys a new bulldozer for $130800. The company depreciates the bulldozer linearly over its useful life of 20 years. It salvage value at the end of 20 years is $19800....
Ответ:
Explanation:
Hello jbagcal
I am sorry I don't know the answer
Thank you