1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
arsen [322]
3 years ago
12

You need to control the number of people who can be in an oyster bar at the same time. Groups of people can always leave the bar

, but a group cannot enter the bar if they would make the number of people in the bar exceed the maximum of 100 occupants. Write a program that reads the sizes of the groups that arrive or depart. Use negative numbers for departures. After each input, display the current number of occupants. As soon as the bar holds the maximum number of people, report that the bar is full and exit the program.
Computers and Technology
1 answer:
Andru [333]3 years ago
4 0

Answer:

count = 0

while True:

   people = int(input("Enter the number of people arrived/departed: "))

   count += people

   

   if count == 100:

       print("The bar is full")

       break

   elif count < 100:

       print("There are " + str(count) + " in the bar currently")

   else:

       print(str(people) + " people cannot enter right now")

       print("The maximum capacity is 100!")

       count -= people

       print("There are " + str(count) + " in the bar currently")

Explanation:

*The code is in Python.

Set the count as 0

Create an indefinite while loop.

Inside the loop:

Ask the user to enter the number of people arrived/departed

Add the people to the count (cumulative sum)

Check the count. If the count is 100, stop the loop. If the count is smaller than 100, print the current number of people. Otherwise, state that they cannot enter right now. The capacity is 100 at most. Subtract the people from the count and print the current number of people.

You might be interested in
Judy is searching for files with a .jpg file extension on her laptop. Which type of file is she looking for?
nikklg [1K]
<span>JPEG files </span><span> are a common file format for digital photos and other digital graphics so she would be looking for a picture

</span>
6 0
3 years ago
Read 2 more answers
The type of line shown below represents an / a:​
VikaD [51]

Answer:

esrfsrtg

Explanation:

6 0
3 years ago
When enabling IPsec mobile client support, you made some selections in the Xauth section of the interface. What does Xauth stand
konstantin123 [22]

Answer:

Extended authentication

Explanation:

Xauth = Extended authentication

An extended authentication can cause security to be increased because it requires the user to enter a username and password. These details would then be authenticated at the internal database of the controller. This extension is an ipsec extension which would enable VPN users to enter a username and password. These details would be required of the user while trying to connect and they would be checked against the login details registered by such a user.

4 0
4 years ago
Code a program that will go through all the numbers from 1 to 100 and print them. However, if the number is evenly divisible by
worty [1.4K]

Answer:

public class Main

{

   // required method

   public static void fizzBuzz(){

       // looping through 1 to 100

       for(int i = 1; i <= 100; i++){

           //if number is evenly divisible by both 3 and 5

           if(i%3 == 0 && i%5 == 0){

               System.out.println("fiz buzz");

           }

                   // if number is divisible by 3

           else if (i%3 == 0){

               System.out.println("fizz");

           }

                        // if number is divisible by 5

           else if (i%5 == 0){

               System.out.println("buzz");

           }

                       // if number is not divisible by both 3 and 5

           else {

               System.out.println(i);

           }

       }

   }

       // main method

       public static void main(String[] args) {

           //calling function

               fizzBuzz();

       }

}

Explanation:

8 0
3 years ago
__init__(self, features, phones): create/initialize instance variables for features and the list of phones (optional) in the pla
vredina [299]

Answer:

class Phone(object):

   def __init__(self, features, phones=[]):

       self.features = features

       self.phones = phones

Explanation:

In python object-oriented programming, an instance variable of a class object is created in the "__init__()" method. the "self" is a convention name used to represent the instance of an object class. The input values are assigned to the object variable with the self.'argument_name' statement.

When the phone argument is not given, the self.phones variable is initialized as an empty list.  

8 0
3 years ago
Other questions:
  • You have inserted new slides based on a Word outline. How do you format these new slides to match the PowerPoint presentation fo
    9·2 answers
  • The first step in creating photographs with good backgrounds is which of the following? Learning to see the background before ta
    11·2 answers
  • The instructions for the OS provided by application software
    14·2 answers
  • In which step of web design is storyboarding helpful?
    14·1 answer
  • Edhesive coding practice 3.4​
    12·1 answer
  • Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline. Ex: If letterToQuit = '
    12·1 answer
  • According to the Doppler effect, objects moving away from Earth would have a
    12·2 answers
  • Writa function to read content from "Zone. txt" and write it into another file "zone1. txt" by reversing each line if the line s
    15·1 answer
  • It is a set of computer instructions​
    10·1 answer
  • (python) Given the formula for conversion from Celsius to Fahrenheit
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!