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
Thanks for the help!
Dafna11 [192]

Answer:

the 1st one i think

Explanation:

6 0
3 years ago
The exhaust steam from a power station turbine is condensed in a condenser operating at 0.0738 bar(abs). The surface of the heat
lozanna [386]

Answer:

Percentage change 5.75 %.

Explanation:Given ;

Given

 Pressure of condenser =0.0738 bar

Surface temperature=20°C

Now from steam table

Properties of steam at 0.0738 bar  

Saturation temperature corresponding to saturation pressure =40°C      

 h_f= 167.5\frac{KJ}{Kg},h_g= 2573.5\frac{KJ}{Kg}

So Δh=2573.5-167.5=2406 KJ/kg

Enthalpy of condensation=2406 KJ/kg

So total heat=Sensible heat of liquid+Enthalpy of condensation

Total\ heat\ =C_p\Delta T+\Delta h

Total heat =4.2(40-20)+2406

Total heat=2,544 KJ/kg

Now film coefficient before inclusion of sensible heat

  h_1=\dfrac{\Delta h}{\Delta T}

  h_1=\dfrac{2406}{20}

h_1=120.3\frac{KJ}{kg-m^2K}

Now film coefficient after inclusion of sensible heat

 h_2=\dfrac{total\ heat}{\Delta T}

 h_2=\dfrac{2,544}{20}

h_2=127.2\frac{KJ}{kg-m^2K}

So\ Percentage\ change=\dfrac{h_2-h_1}{h_1}\times 100

             =\dfrac{127.2-120.3}{120.3}\times 100

                   =5.75 %

So Percentage change 5.75 %.

3 0
2 years ago
What is capillary action?
BARSIC [14]
Capillary action occurs When the adhesion to the walls stronger than dirt cohesive forces between a liquid molecules. the head towards Capillery action will take water in a uniform circular is limited by surface tension and, of course, gravity.
4 0
2 years ago
A steady, incompressible, two-dimensional velocity field is given by the following components in the x-y plane: u=1.85+2.05x+0.6
amm1812

1) a_x=4.287+2.772x\\a_y=-5.579+2.772y

2) 8.418

Explanation:

1)

The two components of the velocity field in x and y for the field in this problem are:

u=1.85+2.05x+0.656y

v=0.754-2.18x-2.05y

The x-component and y-component of the acceleration field can be found using the following equations:

a_x=\frac{du}{dt}+u\frac{du}{dx}+v\frac{du}{dy}

a_y=\frac{dv}{dt}+u\frac{dv}{dx}+v\frac{dv}{dy}

The derivatives in this problem are:

\frac{du}{dt}=0

\frac{dv}{dt}=0

\frac{du}{dx}=2.05

\frac{du}{dy}=0.656

\frac{dv}{dx}=-2.18

\frac{dv}{dy}=-2.05

Substituting, we find:

a_x=0+(1.85+2.05x+0.656y)(2.05)+(0.754-2.18x-2.05y)(0.656)=\\a_x=4.287+2.772x

And

a_y=0+(1.85+2.05x+0.656y)(-2.18)+(0.754-2.18x-2.05y)(-2.05)=\\a_y=-5.579+2.772y

2)

In this part of the problem, we want to find the acceleration at the point

(x,y) = (-1,5)

So we have

x = -1

y = 5

First of all, we substitute these values of x and y into the expression for the components of the acceleration field:

a_x=4.287+2.772x\\a_y=-5.579+2.772y

And so we find:

a_x=4.287+2.772(-1)=1.515\\a_y=-5.579+2.772(5)=8.281

And finally, we find the magnitude of the acceleration simply by applying Pythagorean's theorem:

a=\sqrt{a_x^2+a_y^2}=\sqrt{1.515^2+8.281^2}=8.418

4 0
3 years ago
As car production became more efficient, cars became more affordable for american families. One result of this increase in autom
tankabanditka [31]

Answer:

IT IS SIMPLE LIKE HENRY FORD MADE THIS OPTION POSSIBLE

Explanation:

5 0
2 years ago
Other questions:
  • If a torque of M = 300 N⋅m is applied to the flywheel, determine the force that must be developed in the hydraulic cylinder CD t
    13·1 answer
  • (3) Calculate the heat flux through a sheet of brass 7.5 mm (0.30 in.) thick if the temperatures at the two faces are 150°Cand 5
    9·1 answer
  • The boiler pressure is 38bar and the condenser pressure 0.032 bar.The saturated steam is superheated to 420 oC before entering t
    8·1 answer
  • Which conditions are required for nuclear fusion to begin
    8·1 answer
  • At the instant shown, slider block B is moving with a constant acceleration, and its speed is 150 mm/s. Knowing that after slide
    13·1 answer
  • The dot plot shows the number of cupcakes bought by each person who came to a bake sale.
    15·1 answer
  • All circuits need three basic parts: an energy source, wires, and the object that is going to change the electrical energy into
    5·2 answers
  • What kind of car is this
    8·2 answers
  • (a) Sabbir usually (sit)______ in the front bench.
    13·1 answer
  • A 5.74 kg rock is thrown upwards with a force of 317 N at a location where the local gravitational acceleration is 9.81 m/s^2. W
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!