pizza_Nick
by Anastasia Sharko
JavaScript
'use strict';
var INGREDIENTS = {
'dough': {
specificCarbohydrate: 0.1,
specificFat: 0.001,
specificProtein: 0.01,
specificGravity: 0.4,
specificCaloric: 0.8,
specificPrice: 0.005,
fryWeightLoss: 30
},
'cheese': {
specificCarbohydrate: 0.01,
specificFat: 0.1,
specificProtein: 0.2,
specificGravity: 0.06,
specificCaloric: 0.5,
specificPrice: 0.009,
fryWeightLoss: 40
},
'ham': {
specificCarbohydrate: 0.05,
specificFat: 0.15,
specificProtein: 0.05,
specificGravity: 0.15,
specificCaloric: 0.45,
specificPrice: 0.013,
fryWeightLoss: 25
},
'salami': {
specificCarbohydrate: 0.045,
specificFat: 0.11,
specificProtein: 0.05,
specificGravity: 0.12,
specificCaloric: 0.48,
specificPrice: 0.014,
fryWeightLoss: 20
},
'ketchup': {
specificCarbohydrate: 0.06,
specificFat: 0.01,
specificProtein: 0.01,
specificGravity: 0.01,
specificCaloric: 0.1,
specificPrice: 0.005,
fryWeightLoss: 50
}
};
var recipePepperoni = {
diameter: 30,
ingredients: [
INGREDIENTS.dough,
INGREDIENTS.cheese,
INGREDIENTS.ketchup,
INGREDIENTS.salami
]
};
function Ingredient(ingredient) {
this.specificCaloric = ingredient.specificCaloric || 0;
this.specificCarbohydrate = ingredient.specificCarbohydrate || 0;
this.specificFat = ingredient.specificFat || 0;
this.specificGravity = ingredient.specificGravity || 0;
this.specificPrice = ingredient.specificPrice || 0;
this.specificProtein = ingredient.specificProtein || 0;
this.fryWeightLoss = ingredient.fryWeightLoss || 30;
}
Ingredient.prototype.fry = function () {
this.specificGravity = this.specificGravity * (100 - this.fryWeightLoss) / 100;
};
function Pizza(recipe) {
...