Lilly loves cooking. She wants to throw a pizza party with her friends. To make the most of her ingredients, she needs to know how much of each ingredient she requires before starting.
To solve this, Lilly has drafted a program to automate some of the planning but needs your help finishing it. Will you help Lilly throw the proportionally perfect pizza party?
Lilly is a fan of thin, crispy pizzas with a thinner crust. The dough needed for the middle is a minimum 200g, but every person it serves requires another 20g of dough.
grams = pizzas * ((persons * 20) + 200)
Lilly needs a function that:
For example, to make 4 pizzas that feed 8 people:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateDoughRequirement(4, 8);
// => 1440Lilly is meticulous when applying her sauce, but the size of her pizzas can be inconsistent. From her experience, she knows that it takes 125mL of sauce per pizza. Lilly needs a function that calculates how many cans of sauce to buy.
cans of sauce = pizzas * sauce per pizza / sauce can volume
For example, given Lilly needs to make 8 pizzas, and each can is 250mL:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateSauceRequirement(8, 250);
// => 4Cheese comes in perfect cubes and is sold by size.
The formula Lily uses is not the formula for the area of the pizza since she does not want the cheese to cover the entire area.
She decided to use the following formula to determine how many pizzas of some diameter (diameter) can be made from a cheese cube of some side-length (cheese_dimension):
pizzas = (cheese_dimension³) / (thickness * PI * diameter)
Create a function that:
For example, given a 25x25x25cm cheese cube, 0.5cm thick cheese layer and pizzas 30cm in diameter:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateCheeseCubeCoverage(25, 0.5, 30);
// => 331Finally, Lilly wants her pizzas to divide into 8 slices each and distributed evenly among her friends.
Create a function that:
For example:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateLeftOverSlices(2, 4);
// => 0
$pizza_pi->calculateLeftOverSlices(4, 3);
// => 2Lilly loves cooking. She wants to throw a pizza party with her friends. To make the most of her ingredients, she needs to know how much of each ingredient she requires before starting.
To solve this, Lilly has drafted a program to automate some of the planning but needs your help finishing it. Will you help Lilly throw the proportionally perfect pizza party?
Lilly is a fan of thin, crispy pizzas with a thinner crust. The dough needed for the middle is a minimum 200g, but every person it serves requires another 20g of dough.
grams = pizzas * ((persons * 20) + 200)
Lilly needs a function that:
For example, to make 4 pizzas that feed 8 people:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateDoughRequirement(4, 8);
// => 1440Lilly is meticulous when applying her sauce, but the size of her pizzas can be inconsistent. From her experience, she knows that it takes 125mL of sauce per pizza. Lilly needs a function that calculates how many cans of sauce to buy.
cans of sauce = pizzas * sauce per pizza / sauce can volume
For example, given Lilly needs to make 8 pizzas, and each can is 250mL:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateSauceRequirement(8, 250);
// => 4Cheese comes in perfect cubes and is sold by size.
The formula Lily uses is not the formula for the area of the pizza since she does not want the cheese to cover the entire area.
She decided to use the following formula to determine how many pizzas of some diameter (diameter) can be made from a cheese cube of some side-length (cheese_dimension):
pizzas = (cheese_dimension³) / (thickness * PI * diameter)
Create a function that:
For example, given a 25x25x25cm cheese cube, 0.5cm thick cheese layer and pizzas 30cm in diameter:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateCheeseCubeCoverage(25, 0.5, 30);
// => 331Finally, Lilly wants her pizzas to divide into 8 slices each and distributed evenly among her friends.
Create a function that:
For example:
<?php
$pizza_pi = new PizzaPi();
$pizza_pi->calculateLeftOverSlices(2, 4);
// => 0
$pizza_pi->calculateLeftOverSlices(4, 3);
// => 2