29 lines
898 B
C++
29 lines
898 B
C++
#include "goods.h"
|
|
#include <string>
|
|
|
|
Goods::Goods(std::string name, double price_per_unit, std::string net_weight, double quantity) :
|
|
name(name), price_per_unit(price_per_unit),
|
|
net_weight(net_weight), quantity(quantity) {}
|
|
|
|
double Goods::calculate_total_price() {
|
|
return this->price_per_unit * this->quantity;
|
|
}
|
|
|
|
std::string Goods::get_name() { return this->name; }
|
|
|
|
double Goods::get_quantity() { return this->quantity; }
|
|
|
|
std::string Goods::get_net_weight() { return this->net_weight; }
|
|
|
|
double Goods::get_price_per_unit() { return this->price_per_unit; }
|
|
|
|
void Goods::set_name(std::string name) { this->name = name; }
|
|
|
|
void Goods::set_quantity(double quantity) { this->quantity = quantity; }
|
|
|
|
void Goods::set_net_weight(std::string net_weight) { this->net_weight = net_weight; }
|
|
|
|
void Goods::set_price_per_unit(double price_per_unit) {
|
|
this->price_per_unit = price_per_unit;
|
|
}
|