Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3.33: Pizza Slices Individual Assignment) Use matn operators to construct an expression Use integer division Use the modulus operator to compute a remainder Store a

image text in transcribed

image text in transcribed

3.33: Pizza Slices Individual Assignment) Use matn operators to construct an expression Use integer division Use the modulus operator to compute a remainder Store a value in a variable Use String literals to define a String value Retrieve a value from a variable Output the value of a variable to the console Use String concatenation operator to construct an expression Concatenate the value of a variable and a String Output to console with System.out.println Problem Description and Given Info Complete a Java program that takes two int numbers as the inputs. The first number will be the total number of slices of pizza available, and the second number will be the number of people. The program should compute and output the number of pizza slices each person will get, and the number of pizza slices left over if the pizza slices are divided up so that every person gets the me number of slices. Here is an example of what the user should see when the program runs. Enter total number of slices of pizza : 33 Enter the number of people : 7 4 Number of slices each person will get : Number of slices left over : 5 Be sure to read and understand the code that you are given for this assignment below. You will be adding only the lines of code needed to compute and display the required outputs. Add the required lines where indicated by the comments in the code you are given. Make no other changes to the code you are given for this assignment. For the given inputs, make sure that your program output looks exactly like the example above (including spelling, capitalization, punctuation, spaces, and decimal points). 1 import java.util.Scanner; 2 3 public class Pizzaslices { 4 public static void main(String[] args) { 5 Scanner scnr = new Scanner(System.in); 6 7 // collect the first number from the user. 8 System.out.print("Enter total number of slices of pizza : "); 9 int totalslices = scnr.nextInt(); 10 // collect the second number from the user. 11 System.out.print("Enter the number of people : "); 12 int numberofPeople = scnr.nextInt(); 13 sys 14 il Below this comment: declare any variables you may need 15 16 17 // Below this comment: write a Java statement to compute the number of slices each person will get 18 // and store the result in a variable named slicesPerPerson. 19 20 21 // Below this comment: write a Java statement to compute the number of slices left over 22 // and store the result in a variable named slicesLeftover. 23 24 25 // Below this comment: write a Java statement to display the number of slices each person will get. 26 27 28 // Below this comment: write a Java statement to display the number of slices left over. 29 30 } 31 32

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago