Question: please show using a c++ program. Objective You are to write a program implements a class called Item. The following template explains the class: class

please show using a c++ program.

please show using a c++ program. Objective You are to write aprogram implements a class called Item. The following template explains the class:

Objective You are to write a program implements a class called Item. The following template explains the class: class Item 1 private: string name: double rprice; double wprice: double profit; retail price of item I wholesale price of item N = retail - wholesale public: void init(string n, double price, double wprice) : Winitialization W accessors string getName(): double getRprice(); double getwprice(); double getProfit(); mutators - needed if you want to change the initial values of each private member string setName(string); double setRprice (double price); double getwprice (double prince double calcProfit(); void display(); void compare (Item g): Notice that you have to call an init() function for each object. This will be unnecessary when we learn about constructors. After you initialize an object, you will not be able to change the valus of its private members. To have that capability, you will have to provide mutators to set them either individually or en masse (like the init function). You are to implement the interface, i.e., write the code for the member functions defined in the class. The template for the member functions are shown beloew: void Item::init(string n, double up, double wp) // code for initializing all private members Vacsors are show, do the same for set it string Item!getName() Walso need setName Function to change the name of // code that price the name of the item existing object double Item::getRprice () also need setl price function // code that prints the value of the private member: price double Item::getwprice() also need set price function // code that prints the value of the private member: wprice double Item:: calcprofit() { // code that prints the difference between retail and wholesale price void Item! display() { // code that prints all private member values void Item!! compare (Item g) ! // code that prints which item is more expensive and by how much You should test your objects with a client program that is similar to: int main() { Item adidas, nike, puma adidas.init("Adidas",599.95,299); nike.init("Nike", 499.95, 299); puma.init("Puma", 569.95,249) adidas.display(); nike.display(): puma .display(); cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!