Arrange the following lines to make a program that determines when the number of people in a restaurant equals or exceeds 10 occupants. The program continually gets the number of people entering or...


Drag and drop the unused lines to complete the code.


Arrange the following lines to make a program that determines when the number of people in a restaurant equals or exceeds 10<br>occupants. The program continually gets the number of people entering or leaving the restaurant. Ex: 2 means two people<br>entered, and -3 means three people left. After each input, the program outputs the number of people in the restaurant. Once the<br>number of people in the restaurant equals or exceeds 10, the program exits.<br>If an InputMismatchException exception occurs, the program should get and discard a single string from input. Ex: The input

Extracted text: Arrange the following lines to make a program that determines when the number of people in a restaurant equals or exceeds 10 occupants. The program continually gets the number of people entering or leaving the restaurant. Ex: 2 means two people entered, and -3 means three people left. After each input, the program outputs the number of people in the restaurant. Once the number of people in the restaurant equals or exceeds 10, the program exits. If an InputMismatchException exception occurs, the program should get and discard a single string from input. Ex: The input "2 abc 8" should result in 10 occupants. Not all lines are used in the solution. Mouse: Drag/drop Keyboard: Grab/release Spacebar (or Enter Move 11- Cancel Esc Unused MaxOccupancyTracker.java Load default template.. totalNumPeople += scnr.nextInt(); import java.util.Scanner; import java.util.InputMismatchException; scnr.nextLine(); public class MaxOccupancyTracker { public static void main (String [ args) { System.out.println(" "Error"); scnr.next(); Scanner scnr new Scanner(System.in); } int maxNumPeople 10; int totalNumPeople = 0; } catch (InputMismatchException e) { } System.out.println("We're full!"); if (totalNumPeople < 0)="" {="" totalnumpeople="" }="0;" }="" while="" (totalnumpeople="">< maxnumpeople)="" {="" system.out.println("occupancy:="" +="" totalnumpeople);="">

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here