Question: fill PART1 in c++ #include #include #include using namespace std; class Ingredient { private: string name; float unitPrice; int amount; public: Ingredient() { } Ingredient(string

fill PART1 in c++

fill PART1 in c++ #include #include #include using namespace std; class Ingredient

#include

#include

#include

using namespace std;

class Ingredient {

private:

string name;

float unitPrice;

int amount;

public:

Ingredient() {

}

Ingredient(string name, float unitPrice, int amount) {

this->name = name;

this->unitPrice = unitPrice;

this->amount = amount;

}

string getName() {

return this->name;

}

float getUnitPrice() {

return this->unitPrice;

}

int getAmount() {

return this->amount;

}

void setUnitPrice(int unitPrice) {

this->unitPrice = unitPrice;

}

void print() {

cout name

unitPrice

amount

}

};

float calculateCost(Ingredient*, int);

Ingredient* applyDiscount(Ingredient*, float, int);

bool canCook(vector, vector);

int main() {

return 0;

}

// Calculate the cost of the shopping list corresponding to each ingredient's

// -- unitPrice and amount

float calculateCost(Ingredient *shoppingList, int size) {

// *** FILL THIS FUNCTION FOR PART 1 ***

}

Part I (20 point) Write a function that calculate the cost of the shopping list given by pointers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!