Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Qu All UNIVERSITY OF SHARJAH Name: ID: Define a struct called Ingredient with the components name of type string, quantity, and price both of type

image text in transcribed
Qu" All UNIVERSITY OF SHARJAH Name: ID: Define a struct called Ingredient with the components name of type string, quantity, and price both of type integer. Define a class Recipe with private members name, NumIngrediants, and Al) an array of type Ingredient, clacuateCost which clacualtes and returns the total cost of all ingrediants. The class Recipe has the public members seto, print, a default paramatrized constructor. The following driver produces the given sample of input/output: int main Recipe Tabeech; Tabeech.set("Manssef", 4); Tabeech.print(); return 0; Sample input/output: Enter the name, quantity and price of ingredient number 1: Mutton 1000 45 Enter the name, quantity and price of ingredient number 2: Gammed 300 5 Enter the name, quantity and price of ingredient number 3: Rice 500 8 Enter the name, quantity and price of ingredient number 4: Parsley 20 1 The recipe Manssef has 4 ingredients The total cost of ingredients is 59

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

Students also viewed these Databases questions

Question

friendliness and sincerity;

Answered: 1 week ago