Question: c++ problem here is starter code: ******************************************************************************************* // @file Item.h #ifndef ITEM_H #define ITEM_H #include class Item { public: // constructors Item(std::string name, double price,

c++ problem

here is starter code:

*******************************************************************************************

// @file Item.h

#ifndef ITEM_H

#define ITEM_H

#include

class Item {

public:

// constructors

Item(std::string name, double price, int quantity);

// accessors

std::string get_name() const;

double get_price() const;

int get_quantity() const;

// mutators

void set_price(double new_price);

void set_quantity(int new_quantity);

// other methods

void print() const;

private:

std::string name; /// name of the item

double price; /// price for one item

int quantity; /// how many are you buying?

};

#endif

******************************************************************************************************

// @file Item.cpp

#include "Item.h"

#include

#include

Item::Item( std::string name, double price, int quantity ) {

this->name = name; // `this->` means "self"

this->price = price;

this->quantity = quantity;

}

std::string Item::get_name( ) const {

return name;

}

double Item::get_price( ) const {

return price;

}

int Item::get_quantity( ) const {

return quantity;

}

void Item::set_price( double new_price ) {

price = new_price;

}

void Item::set_quantity( int new_quantity ) {

quantity = new_quantity;

}

void Item::print( ) const {

std::cout

std::cout

std::cout

std::cout

}

****************************************************************

c++ problem here is starter code: ******************************************************************************************* // @file Item.h #ifndef ITEM_H#define ITEM_H #include class Item { public: // constructors Item(std::string name, double

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!