We need to create a class with the following characteristics:
We need to create a class with the following characteristics: 1. The class name should be Product. 2. The class should contain 4 data fields: a. Product reference number (unsigned) b. Product name (string) c. Price per unit/pound (double) d. Items/pounds remaining in the store (unsigned) 3. The class should have the following methods: a. A constructor that takes all the information as parameters to fill the data fields in the order described above. b. An accessor called “get_name” that takes no parameters and returns the name of the product c. An accessor called “get_price” that takes no parameters and returns the price of the product d. An accessor called “stock” that takes no parameters and returns the number of items/pounds of the current product remaining in the store e. A mutator procedure called “sold” that takes in the number of items sold of the current product and updates the value for the number of items remaining in stock f. A mutator procedure called “addToStock” that takes in the number of items of the current product that enter into the store and updates the value of items remaining in the store g. An accessor called “info” that takes no parameters and displays the information of the product on the screen in the following order, with no spaces between lines. Please DO NOT add any dollar symbols or special character. Just show the names and numbers as shown below. Product Name: Orange Reference Number: 1123456 Price per unit/pound: 0.99 Stock: 34
Join our real-time social learning platform and learn together with your friends!