102k views
5 votes
Complete the PizzaCaloriesPerSlice() function to compute the calories for a single slice of pizza. A Pizza Calories() function returns a pizza's total calories given the pizza diameter passed as an argument. A PizzaSlices() function returns the number of slices in a pizza given the pizza diameter passed as an argument.

User Imperalix
by
5.9k points

1 Answer

1 vote

Answer: Provided in the explanation section

Step-by-step explanation:

The question tells us to;

Complete the PizzaCaloriesPerSlice() function to compute the calories for a single slice of pizza. A Pizza Calories() function returns a pizza's total calories given the pizza diameter passed as an argument. A PizzaSlices() function returns the number of slices in a pizza given the pizza diameter passed as an argument.

The answer to this goes like this:

1.

totalCalories= pizzaCalories(pizzaDiameter);

Step-by-step explanation: As mentioned in question pizzaCalories method will return total calories.

2.

caloriesPerSlice = totalCalories/pizzaSlices(pizzaDiameter);

Step-by-step explanation: As mentioned in question pizzaSlices will return number of pizza slices . so dividing total calories by pizzaSlices() will give us caloriesPerSlice.

User Washery
by
5.0k points