Ask Question
30 April, 21:41

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 =

+1
Answers (1)
  1. 1 May, 00:01
    0
    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.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Complete the pizzaCaloriesPerSlice () method to compute the calories for a single slice of pizza. A pizzaCalories () method returns a ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers