Exemple #1
0
void Ingridients::writeFood(QJsonObject& json, Food& food) const {
    PRINT_DEBUG("Writing food" << food.getName());

    json["name"] = QString::fromStdString(food.getName());
    json["mass"] = static_cast<qint64>(food.getMass());
    json["price"] = static_cast<qint64>(food.getPrice());
    json["measureType"] = static_cast<int>(food.getUnitType());
    json["fats"] = static_cast<qint64>(food.getFats());
    json["proteins"] = static_cast<qint64>(food.getProteins());
    json["carbohydrates"] = static_cast<qint64>(food.getCarbohydrates());
    json["calories"] = static_cast<qint64>(food.getCalories());
}
Exemple #2
0
double ::TaxVisitor::visit(Food& good) //10%
{
	int price = good.getPrice();
	int tax = price / 10;
	return tax + price;
}