subject

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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Exchanging which type of data uses the least bandwidth? music photographs video voice bandwidth- the amount of data that can be moved between two points in a set time period
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
Martha is designing a single-player game. her manager suggests that she plan the design to incorporate future modifications. which principle of game design relates to planning for future modifications?
Answers: 1
question
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
You know the right answer?
Create a script called retail_store. js. In this script code the following: A. Class and Constructo...
Questions
question
Mathematics, 24.01.2020 05:31
Questions on the website: 13722360