Ask Question
13 December, 15:26

Complete the PizzaCaloriesPerSlice () function to compute the calories for a single slice of pizza. A PizzaCalories () 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. qustion: Type the expression for Placeholder_B to compute the calories per slice. caloriesPerSlice =

+5
Answers (1)
  1. 13 December, 15:34
    0
    The Java code is given below with appropriate comments

    Explanation:

    //Declare the class

    public class CaloriesCount

    {

    / / Definition of the method

    public static double PizzaCaloriesPerSlice (

    double diameter)

    {

    / / To calculate calories per count

    double caloriesPerSlice = PizzaCalories (diameter)

    / PizzaSlices (diameter);

    / / return the value.

    return caloriesPerSlice;

    }

    / / Definition of method to calculate pizza calories.

    public static double PizzaCalories (double diameter)

    {

    / / return value

    return 2 * 3.14 * (diameter / 2);

    }

    / / definition to return pizza calories.

    public static double PizzaSlices (double diameter)

    {

    return 8.0;

    }

    / / start the main method.

    public static void main (String[] args)

    {

    / / Call the method.

    System. out. println (PizzaCaloriesPerSlice (24));

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Complete the PizzaCaloriesPerSlice () function to compute the calories for a single slice of pizza. A PizzaCalories () function 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