Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Arrange the following lines to make a program that determines when the number of people in a restaurant equals or exceeds 1 0 occupants. The

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 8n should result in 10 occupants. Not all lines are used in the solution.
How to use this tool
Unused
}
}
catch {
try {
}
catch (InputMismatchException e){
senr. next ();
scnr. nextline();
System.out.println("Error");
totalNumPeople += scnr. nextInt ();
while (totalNumPeople maxNumPeople){
System.out.println("Occupancy: "+ totalNumPeople);
MaxOccupancyTracker.java
Load default template...
import java.util.scanner;
import java.util. Input/MismatchException;
public class MaxOccupancyTracker {
public static void main(String [] args) f
Scanner scnr = new Scanner(
System.in);
int maxNumPeople =10;
int totalNumPeople =;
System.out.println("We're full!"); }}
image text in transcribed

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

Step: 3

blur-text-image

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

What are the key tenets of expectancy theory?

Answered: 1 week ago

Question

2. Do the same for your favorite female film character.

Answered: 1 week ago

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

Describe the new structures for the HRM function. page 676

Answered: 1 week ago