Ask Question
20 February, 05:53

To plan a pizza party, one may want to order enough pizza for everyone. Use the slicesPerPizza, slicesPerGuest, and totalGuests variables to compute the total number of pizzas needed to feed all the guests and store the result in pizzasNeeded. The total may have a decimal place.

+3
Answers (1)
  1. 20 February, 06:58
    0
    import java. util. Scanner;

    public class num6 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter number of guest");

    int totalGuest = in. nextInt ();

    System. out. println ("Enter number of slices per guest");

    int slicesPerGuest = in. nextInt ();

    System. out. println ("How many Slices are on a pizza");

    int slicesPerPizza = in. nextInt (); / / Assume each pizza has 5 slices

    double pizzasNeeded;

    //Calculating the pizza Needed

    int totalslicesNeeded = totalGuest * slicesPerGuest;

    pizzasNeeded = totalslicesNeeded/slicesPerPizza;

    System. out. println (pizzasNeeded);

    }

    }

    Explanation:

    In this program User is required to enter values for the variables totalGuest, slicesPerGuest and slicesPerPizza

    First calculate the totalSlices needed by totalGuest * slicesPerGuest;

    The calculate number of pizzas needed by totalslicesNeeded/slicesPerPizza;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “To plan a pizza party, one may want to order enough pizza for everyone. Use the slicesPerPizza, slicesPerGuest, and totalGuests variables ...” 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