//Micah Krosby CS1A Ch. 3, P. 147, # 19
/*******************************************************************************
* CALCULATE AMOUNT OF PIZZAS FOR A GROUP
* _____________________________________________________________________________
* This program finds the amount of pizzas a group would need depending on pizza
* diameter and the amount of people in the group.
*
* FORMULAE-
* Area required = people * slices per person * single slice area
* Pizzas required = area required / (pi * (diameter / 2)^2)
* _____________________________________________________________________________
*
* CONSTANTS-
* MATH_PI : Value of pi rounded to nearest hundredth
* SLICES_PER_PERSON : Amount of slices one person will eat
* SINGLE_SLICE_AREA : Amount of area one slice might have
*
* INPUTS-
* attendance : Amount of people attending
* diameter : Requested diameter of pizzas
*
* OUTPUTS-
* sliceArea : Amount of pizza area required
* pizzaQuantity : Amount of pizzas required
*
*******************************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
#define MATH_PI 3.14 //CONST- Pi rounded to the nearest hundredth
#define SLICES_PER_PERSON 4 //CONST- Amount of slices per person
#define SINGLE_SLICE_AREA 14.125 //CONST- Amount of area in one slice
using namespace std;
int main() {
int attendance; //INPUT- Amount of people attending
float diameter; //INPUT- Diameter of pizzas requested
float sliceArea; //OUTPUT- Area of pizzas requested
float pizzaQuantity; //OUTPUT- Quantity of pizzas required
//Initialize input variables
cout << "How many people will be attending?" << endl;
cin >> attendance;
cout << "What diameter shall the pizzas be?" << endl;
cin >> diameter;
//Calculate output variables
sliceArea = attendance * SLICES_PER_PERSON * SINGLE_SLICE_AREA;
pizzaQuantity = sliceArea / (MATH_PI * pow(diameter / 2, 2));
//Output
cout << "The amount of pizzas required will be " << ceil(pizzaQuantity)
<< endl;
return 0;
}