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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:00, eden1017
Why should characters such as / \ " ' * ; - ? [ ] ( ) ~ ! $ { } < > # @ & | space, tab, and newline be avoided in file names?
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, keviongardner
The next button in the review section shows the next available comment. next slide with no comment. previous comment. edited comment.
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, muncyemily
From excel to powerpoint, you can copy and paste a. cell ranges and charts, one at a time. b. cell ranges and charts, simultaneously. c. charts only. d. cell ranges only.
Answers: 3
image
Computers and Technology, 23.06.2019 21:30, quintonps12
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
Do you know the correct answer?
Create a script called retail_store. js. In this script code the following: A. Class and Constructo...

Questions in other subjects:

Konu
Mathematics, 15.12.2020 20:30
Konu
Mathematics, 15.12.2020 20:30