First Interaction with User Interface #1

Merged
andrewlalis merged 11 commits from development into master 2018-02-12 19:40:45 +00:00
2 changed files with 20 additions and 8 deletions
Showing only changes of commit b6093aeee9 - Show all commits

View File

@ -1,11 +1,11 @@
#include "model/recipe/ingredients/recipeingredient.h"
RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){
RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){
setQuantity(quantity);
setUnit(unit);
}
RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit){
RecipeIngredient::RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit){
setId(i.getId());
setName(i.getName());
setFoodGroup(i.getFoodGroup());
@ -13,11 +13,19 @@ RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure uni
setUnit(unit);
}
float RecipeIngredient::getQuantity(){
return this->quantity;
}
UnitOfMeasure RecipeIngredient::getUnit(){
return this->unit;
}
string RecipeIngredient::getComment(){
return this->comment;
}
void RecipeIngredient::setQuantity(int newQuantity){
void RecipeIngredient::setQuantity(float newQuantity){
this->quantity = newQuantity;
}

View File

@ -15,18 +15,22 @@ using namespace std;
class RecipeIngredient : public Ingredient
{
public:
RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit);
RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit);
//Constructor for new RecipeIngredient without starting child ingredient.
RecipeIngredient(int id, string name, string foodGroup, float quantity, UnitOfMeasure unit);
//Constructor using data from a child ingredient.
RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit);
int getQuantity();
//Getters
float getQuantity();
UnitOfMeasure getUnit();
string getComment();
void setQuantity(int newQuantity);
//Setters
void setQuantity(float newQuantity);
void setUnit(UnitOfMeasure newUnit);
void setComment(string newComment);
private:
int quantity;
float quantity;
UnitOfMeasure unit;
string comment;
};