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
1. Which of the following is the ideal way to apply pressure onto pedals?
Vikki [24]
I think D. By pressing gradually
8 0
3 years ago
Read 2 more answers
Another focus of effective communication, according to Stephen Covey, is ensuring that:
svetoff [14.1K]

Answer:

Stephen Covey believes this principle is the key to effective interpersonal communication. Seek first to understand, then to be understood. This habit is about communicating with others. It's about developing the habit of listening carefully and really understanding the other person BEFORE giving your thoughts.

Explanation:

4 0
3 years ago
Read 2 more answers
Define extensive and intensive properties of thermodynamic system.
Flura [38]

Answer:

An intense property is a physical attribute of a system that is independent of the size of the system or the quantity of material it contains. An extensive property of a system, on the other hand, is dependent on the size of the system or the amount of material in it.

Explanation:

7 0
3 years ago
Read 2 more answers
The proposed grading at a project site will consist of 25,100 m3 of cut and 23,300 m3 of fill and will be a balanced earthwork j
Anna [14]

Answer:

the volume of water that will be required to bring these soils to the optimum moisture content is 1859 kL

Explanation:

Given that;

volume of cut = 25,100 m³

Volume of dry soil fill = 23,300 m³

Weight of the soil will be;

⇒ 93% × 18.3 kN/m³ × 23,300 m³

= 0.93 × 426390 kN 3

= 396,542.7 kN  

Optimum moisture content = 12.9 %

Required amount of moisture = (12.9 - 8.3)% = 4.6 %

So,

Weight of water required = 4.6% × 396,542.7 = 18241 kN

Volume of water required = 18241 / 9.81 = 1859 m³

Volume of water required = 1859 kL

Therefore, the volume of water that will be required to bring these soils to the optimum moisture content is 1859 kL

6 0
3 years ago
For some transformation having kinetics that obey the Avrami equation (Equation 10.17), the parameter n is known to have a value
OleMash [197]

Answer:

t = 25.10 sec

Explanation:

we know that Avrami equation

Y = 1 - e^{-kt^n}

here Y is percentage of completion  of reaction = 50%

t  is duration of reaction = 146 sec

so,

0.50 = 1 - e^{-k^146^2.1}

0.50 = e^{-k306.6}

taking natural log on both side

ln(0.5) = -k(306.6)

k = 2.26\times 10^{-3}

for 86 % completion

0.86 = 1 - e^{-2.26\times 10^{-3} \times t^{2.1}}

e^{-2.26\times 10^{-3} \times t^{2.1}} = 0.14

-2.26\times 10^{-3} \times t^{2.1} = ln(0.14)

t^{2.1} = 869.96

t = 25.10 sec

5 0
3 years ago
Other questions:
  • How does the modern Diesel engine achieve higher power output without the use of higher compression ratio?
    5·1 answer
  • A six-lane multilane highway (three lanes in each direction) has a peak-hour factor of 0.90, 11-ft lanes with a 4-ft right-side
    11·1 answer
  • 37. In ______ combination of drugs, the effects of one drug cancel or diminish
    12·1 answer
  • There are 22 gloves in a drawer: 5 pairs of red gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the da
    13·1 answer
  • W<br>n só<br>i<br>Eo<br>E<br>find the transfer function​
    9·1 answer
  • Is a unit of measurement for angles
    15·1 answer
  • A pulse-jet baghouse is desired for a finished cement plant. Calculate the number of bags required to filter 500 m3/min of air w
    7·1 answer
  • Which of the following was a sustainable power source used during the Middle Ages?
    9·2 answers
  • a coiled spring is stretched 31.50 cm by a 2.00N weight. How far is it stretched by a 10.00 N weight?
    6·1 answer
  • How many squares titles (20cm x 20cm) are needed to coat the sides and base of a pool which is 10m long, 6 meter wide and 3m dee
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!