Make number of ingredients dynamic
- 主要語言
- C++
- 星號
- 0
- 分支
- 6
- PR 合併指標
- 30 天內沒有已合併 PR
描述
The code done so far has 5 variables each for each ingredient and 5 variables each for the amount of it required. This is a very inefficient kind of coding. Make changes such that any number of ingredients can be accepted i.e. to a realistic extent(Not something as high as 20!). Make sure that this change compliments with the rest of the project( Makes sense and does not create any new bugs)
> class Item: public Cafeteria,public Accounts// An object of the type item must be s=created for each item. Can use array of objects.
{
private://Ingridieants required for the item
int item_id;
int price;
char *ingridient1;
float amt1;
char *ingridient2;
float amt2;
char *ingridient3;
float amt3;
char *ingridient4;
float amt4;
char *ingridient5;
float amt5;
int stock;
public:
Item(int id,int p,char *i1,float a1,char *i2,float a2,char *i3,float a3,char *i4,float a4,char *i5,float a5)
{
item_id=id;
price=p;
ingridient1=i1;ingridient2=i2;ingridient3=i3;ingridient4=i4;ingridient5=i5;
amt1=a1;amt2=a2;amt3=a3;amt4=a4;amt5=a5;
};//constructor. Specified in main function by program. Owner or Employee cannot make changes.
void personBoughtItem(){
addBill(price);};
void ingridientsForNextWeek(){
deductExpenses(amt1+amt2+amt3+amt4+amt5);
};
};
貢獻指南
評估
這個 Issue 還沒有評估資料。