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
The fracture strength of glass may be increased by etching away a thin surface layer. It is believed that the etching may alter
UkoKoshka [18]
Maybe it willl be I don’t know
7 0
2 years ago
A ____ is marked by two sets of double yellow lines, with each set having a broken line on the inside, and a solid line on the o
Vitek1552 [10]

Answer:

  center left-turn lane

Explanation:

A <em>center left turn lane</em> will be marked as described. The arrows, if present, generally indicate that left turns are permitted from the lane with these markings.

__

If the double yellow lines are solid, they are considered to be a "barrier" and are not to be crossed.

7 0
3 years ago
Read 2 more answers
List one advantage and one disadvantage of the use of the commutator?
Mariulka [41]

Answer and  Explanation:

Commutator are used in DC machine commutator is mainly used for the reversing the direction of the current .It is connected to the armature of the DC generator or motor

ADVANTAGE OF COMMUTATOR The main advantage of the commutator in DC motor is to keep keep the direction of the toque always in the same direction by changing the current direction

DISADVANTAGE OF COMMUTATOR : The main disadvantage is due to the friction between the commutator and brushes there is a friction loss.

3 0
3 years ago
A sports car has a drag coefficient of 0.29 and a frontal area of 20 ft2, and is travelling at a speed of 120 mi/hour. How much
Andrej [43]

Answer:

Power required to overcome aerodynamic drag is 50.971 KW

Explanation:

For explanation see the picture attached

4 0
2 years ago
Indicate the correct statement about the effect of Reynolds number on the character of the flow over an object.
sergeinik [125]

Answer:

If Reynolds number increases the extent of the region around the object that is affected by viscosity decreases.

Explanation:

Reynolds number is an important dimensionless parameter in fluid mechanics.

It is calculated as;

R_e__N} = \frac{\rho vd}{\mu}

where;

ρ is density

v is velocity

d is diameter

μ is viscosity

All these parameters are important in calculating Reynolds number and understanding of fluid flow over an object.

In aerodynamics, the higher the Reynolds number, the lesser the viscosity plays a role in the flow around the airfoil. As Reynolds number increases, the boundary layer gets thinner, which results in a lower drag. Or simply put, if Reynolds number increases the extent of the region around the object that is affected by viscosity decreases.

5 0
2 years ago
Other questions:
  • Which one of the following statements about the Wright brothers is not true?
    6·1 answer
  • Consider 1.0 kg of austenite containing 1.15 wt% C, cooled to below 727C (1341F). (a) What is the proeutectoid phase? (b) How
    14·1 answer
  • Fixed rate mortgage offer:
    10·1 answer
  • A(94,0,14) B(52,56,94) C(10,6,48) D(128,64,10)
    6·1 answer
  • Design drawings use line styles of up to eight different varieties to communicate important information about the item. true or
    7·1 answer
  • What is government role in the modern American version of capitalism
    11·1 answer
  • Should i show my face?
    8·2 answers
  • 3. Determine the most unfavorable arrangement of the crane loads and
    6·1 answer
  • Chọn dữ liệu phù hợp và biểu diễn chúng dưới dạng biểu đồ, từ đó cho biết 3 yếu tố
    7·1 answer
  • The centre of the circumstancribing circle of a triangle can be found by using the
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!