here is the header file and cpp file for priceListItem just need to fill the mis
ID: 3888909 • Letter: H
Question
here is the header file and cpp file for priceListItem just need to fill the mising things program must be in c++
PriceListItem.h
#pragma once
#include <string>
using namespace std;
class PriceListItem {
public:
PriceListItem();
PriceListItem(const string &itemName, const string &code, double price, bool taxable);
string getItemName();
string getCode();
double getPrice();
bool isTaxable();
private:
// any private member variables and methods go here
// TO BE COMPLETED
};
=======================================================================================================================================
PriceListItem cpp.
#include "PriceListItem.h"
PriceListItem::PriceListItem(const string &itemName, const string &code, double price, bool taxable) {
// TO BE COMPLETED
}
PriceListItem::PriceListItem() {
// TO BE COMPLETED
}
string PriceListItem::getItemName() {
// TO BE COMPLETED
}
string PriceListItem::getCode() {
// TO BE COMPLETED
}
double PriceListItem::getPrice() {
// TO BE COMPLETED
}
bool PriceListItem::isTaxable() {
// TO BE COMPLETED
}
Explanation / Answer
//PriceListItem.h
#ifndef PRICELIST_ITEM
#define PRICELIST_ITEM
#include<iostream>
#include <string>
using namespace std;
class PriceListItem {
private:
// private member variables
string itemName;
string code;
double price;
bool taxable;
public:
PriceListItem();
PriceListItem(const string &itemName, const string &code, double price, bool taxable);
string getItemName();
string getCode();
double getPrice();
bool isTaxable();
};
#endif PRICELIST_ITEM
--------------------------------------------------------------------------------------------------------------------------------------------
//PriceListItem cpp.
#include<iostream>
#include<string>
#include "PriceListItem.h"
using namespace std;
//paramter constructor
PriceListItem::PriceListItem(const string &itemName, const string &code, double price, bool taxable) {
this->itemName=itemName;
this->code=code;
this->price=price;
this->taxable=taxable;
}
//default constructor
PriceListItem::PriceListItem() {
this->itemName="";
this->code="";
this->price=0;
this->taxable=false;
}
//Returns item name
string PriceListItem::getItemName() {
return itemName;
}
//Returns item code
string PriceListItem::getCode() {
return code;
}
//Returns item price
double PriceListItem::getPrice() {
return price;
}
//Returns boolean value
bool PriceListItem::isTaxable() {
return taxable;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.