Ask Question
6 September, 00:58

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 =

+5
Answers (1)
  1. 6 September, 01:04
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers