2

# Cost of Pizza (Id-1412)

Bonus Practice Sheet Winter 2018 [17-Mar-2018 to 7-Apr-2018]

Program ID- 1412

Pizza is a delicious circular food item that is a favorite for many people. Given the radius of the pizza, ingredients required for the preparation of the pizza, per square cm (cm2) area of the pizza and cost of its ingredients per 100 grams, design an OOP model and write a C++ program to calculate the cost of the pizza. Add Rs 50 for veg pizza and Rs 100 for chicken pizza. Use 3.14 for pi. Your program should  get all the ingredients available in the kitchen with their cost per 100 grams, as an input.  Assume that all the ingredients required for the preparation of the pizza is available in the kitchen.

Note: Syntax to print ‘x’ decimal places of variable ‘a’

include <iomanip>

use

cout<<fixed<<setprecision(x)<<a;

Input Format

Give 0 for veg pizza and 1 for chicken pizza

Number of ingredients required for the preparation of the pizza

Name of ingredient1

Quantity of ingredient1 required (in grams)

Name of ingredient2

Quantity of ingredient2 required

….

Name of ingredient-n

Quantity of ingredient-n required

Number of ingredients available in the kitchen.

Name of ingredient-1 available in the kitchen

Cost of 100 gm of ingredient1 available in kitchen

Name of ingredient-2 in kitchen

Cost of 100 gm of ingredient2 in kitchen

….

Name of ingredient-n in kitchen

Cost of 100 gm of ingredient-n in kitchen

Output Format

Cost of pizza

Code

Please Comment Working if the code worked to you

If you have other working codes please comment the codes enclosing with <pre> and </pre> 🙂

C++ Code

The Above Codes are for reference only. It doesn't mean everyone to directly copy/paste those codes.

Yash - March 21, 2018

tmp/tmpoHXjZt/Hello.cpp: In member function ‘void kitchen::get_K()’:
/tmp/tmpoHXjZt/Hello.cpp:63:10: error: ‘num’ was not declared in this scope
cin>>num;
^