Ask Question
5 February, 21:53

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 =

+3
Answers (1)
  1. 5 February, 22:11
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers