Complete the pizzaCaloriesPerSlice() method to compute the calories for a single slice of pizza. A pizzaCalories() method returns a pizza's total calories given the pizza diameter passed as an argument. A pizza Slices() method returns the number of slices in a pizza given the pizza diameter passed as an argument. double pizzacaloriesPerSlice(double pizzaDiameter) { double totalcalories; double caloriesPerSlice; totalCalories - Placeholder_A; calories Perslice - Placeholder_B; return caloriesPerSlice;
1) Type the expression for Placeholder. A to compute the total calories for a pizza with diameter pizzaDiameter totalCalories =
2) Type the expression for Placeholder_B to compute the calories per slice calories Perslice =

Respuesta :

Answer:

Following are the answer to this question:

1) totalCalories= pizzaCalories(pizzaDiameter); \\defining a variable totalCalories that holds method return value.

2) caloriesPerSlice = totalCalories/pizzaSlices(pizzaDiameter); \\defining a variable caloriesPerSlice that divides totalCalories by the method "pizzaSlices" return value.

Explanation:

Following are the description of the above code:

  • In the first code, a double variable totalCalories that holds method return value. In other words, we can say that method returns its value in totalCalories.
  • In the second code, the method "pizzaSlices" return value divides by the totalCalories variable and this values will be saved in caloriesPerSlice.
ACCESS MORE