Ask Question
14 September, 09:17

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.

+5
Answers (1)
  1. 14 September, 09:43
    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 & 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