acmpesuecc / acmpesuecc/cafe

Make number of ingredients dynamic

Offen
#2 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bounty~30 enhancement
Vorherrschende Sprache
C++
Sterne
0
Forks
6
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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);
};
};

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.