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" #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); setQuantity(quantity);
setUnit(unit); setUnit(unit);
} }
RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit){ RecipeIngredient::RecipeIngredient(Ingredient i, float quantity, UnitOfMeasure unit){
setId(i.getId()); setId(i.getId());
setName(i.getName()); setName(i.getName());
setFoodGroup(i.getFoodGroup()); setFoodGroup(i.getFoodGroup());
@ -13,11 +13,19 @@ RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure uni
setUnit(unit); setUnit(unit);
} }
float RecipeIngredient::getQuantity(){
return this->quantity;
}
UnitOfMeasure RecipeIngredient::getUnit(){
return this->unit;
}
string RecipeIngredient::getComment(){ string RecipeIngredient::getComment(){
return this->comment; return this->comment;
} }
void RecipeIngredient::setQuantity(int newQuantity){ void RecipeIngredient::setQuantity(float newQuantity){
this->quantity = newQuantity; this->quantity = newQuantity;
} }

View File

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