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
Galina-37 [17]
3 years ago
5

This method will sell the seat in row i and column j unless it is already sold. A ticket is sold if the price of that seat in th

e array is 0. If the ticket is not sold, add the price of the seat in row i and column j to the totalSales and then set the price of that seat to 0 to designate it has been sold and return true since a sell was made. If the ticket was already sold, then return false.
Engineering
1 answer:
blsea [12.9K]3 years ago
8 0

Answer:

The solution code is written in Java.

  1. public class Movie {
  2.    private double  [][] seats = new double[5][5];
  3.    private double totalSales;
  4.    public Movie(){
  5.        for(int i= 0; i < this.seats.length; i++){
  6.            for(int j = 0; j < this.seats[i].length; j++){
  7.                this.seats[i][j] = 12;
  8.            }
  9.        }
  10.        this.totalSales = 0;
  11.    }
  12.    public boolean bookSeat(int i, int j)
  13.    {
  14.        if(this.seats[i][j] != 0){
  15.            this.totalSales += this.seats[i][j];
  16.            this.seats[i][j] = 0;
  17.            return true;
  18.        }else{
  19.            return false;
  20.        }
  21.    }
  22. }

Explanation:

The method, bookSeat(), as required by the question is presented from Line 16 - 26 as part of the public method in a class <em>Movie</em>.  This method take row,<em> i</em>, and column,<em> j</em>, as input.

By presuming the seats is an two-dimensional array with all its elements are  initialized 12 (Line 7 - 10). This means we presume the movie ticket price for all the seats are $12, for simplicity.

When the<em> bookSeat() </em>method is invoked, it will check if the current price of seats at row-i and column-i is 0. If not, the current price, will be added to the <em>totalSales </em>(Line 19)<em> </em>and then set the price to 0 (Line 20) and return <em>true</em> since the ticket is successfully sold (Line 21).  If it has already been sold, return <em>false</em> (Line 23).

You might be interested in
Someone please help me with this I’m stuck on it ?!i don’t have a lot of time
Kitty [74]
Python, Ruby, JavaScript, Java, and C++
6 0
3 years ago
How does an electric circuit work?<br><br> Please give a detailed answer- thx
nydimaria [60]

Answer:

An electric current in a circuit transfers energy from the battery to the circuit components. No current is 'used up' in this process. In most circuits, the moving charged particles are negatively charged electrons that are always present in the wires and other components of the circuit.

3 0
3 years ago
Read 2 more answers
What is the De Broglie wavelength of an electron under 150 V acceleration?
yanalaym [24]

Answer:

0.1 nm

Explanation

Potential deference of the electron is given as V =150 V

Mass of electron m=9.1\times 10^{-31}

Let the velocity of electron = v

Charge on the electron =1.6\times 10^{-19}C

plank's constant h =6.67\times 10^{-34}

According to energy conservation eV =\frac{1}{2}mv^2

v=\sqrt{\frac{2eV}{M}}=\sqrt{\frac{2\times 1.6\times 10^{-19}\times 150}{9.1\times 10^{-31}}}=7.2627\times 10^{-6}m/sec

Now we know that De Broglie wavelength \lambda =\frac{h}{mv}=\frac{6.67\times 10^{-34}}{9.1\times 10^{-31}\times 7.2627\times10^6 }=0.100\times 10^{-9}m=0.1nm

4 0
3 years ago
Read 2 more answers
Can you gift points in this if yes please send some
dimaraw [331]
No, you can’t sorry :(
4 0
4 years ago
Read 2 more answers
primitive transportation and storage systems that make local distribution ineffective if not impossible, the lack of clean water
Vera_Pavlovna [14]

Primitive transportation and storage systems that make local distribution ineffective if not impossible, and the lack of clean water and the lack of effective sewer systems are all examples of the barrier called physical & environmental barriers.

<h3>What are the problems with having physical & environmental barriers?</h3>

Time, Place, Space, Climate, and Noise are the key environmental/physical constraints. Some are simple to change, while others may prove to be difficult.

Physical barriers are essentially defined by three primary factors: environment, distance, and medium unawareness. Environmental barriers, on the other hand, are connected to variables that occur in the current environment.

Learn more about transportation:
brainly.com/question/27667264
#SPJ1

5 0
1 year ago
Other questions:
  • Find the thickness of the material that will allow heat transfer of 6706.8 *10^6 kcal during the 5 months through the rectangle
    8·1 answer
  • Design a sequential circuit with two D flip-flops A and B, and one input x_in.
    12·1 answer
  • A cubic transmission casing whose side length is 25cm receives an input from the engine at a rate of 350 hp. If the vehicle's ve
    5·1 answer
  • Find the requested quantities for the circuit. We used the mesh-current method to identify the meshes. We then identified the me
    5·1 answer
  • Two aerial photographs were taken 30 seconds apart over one east-bound lane of l-80 near Grand Island, NE. The following results
    12·1 answer
  • A silicon diode has a saturation current of 6 nA at 25 degrees Celcius. What is the saturation current at 100 degrees Celsius?
    15·1 answer
  • Scientists believe that our solar system formed about 4.6 billion years ago from a cloud of hydrogen, helium, rock, ice, dust, a
    13·2 answers
  • Taking the convection heat transfer coefficient on both sides of the plate to be 860 W/m2 ·K, deter- mine the temperature of the
    10·1 answer
  • Increase time to respond to threats through position and speed adjustments is risk management.
    9·1 answer
  • Which of the following scenarios describes an advantage of a global economy?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!