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
ILL GIVE YOU BRAINLIEST PLEASE HELP PLEASE
Lesechka [4]

Answer:

try to pop it back in good luck im scared for you

4 0
2 years ago
The efficiency of a transformer is mainly dependent on: a)- Core losses b)- Copper losses c)- Stray losses d)- Dielectric losses
natima [27]

The efficiency of a transformer is mainly dependent on a)- Core losses

Hope this helps! :)

6 0
2 years ago
Las dos torres que sostienen un puente colgante tienen una separación de 240m y una altura de 110m a partir de la carretera, si
Sveta_85 [38]

La altura es de 169.4 metros.

Dado que las dos torres que sostienen un puente colgante tienen una separación de 240m y una altura de 110m a partir de la carretera, si el cable tensor más corto mide 10m, para determinar cuál es altura de un cable que se encuentra a 100m de distancia del centro se debe realizar los siguientes cálculos, aplicando la ecuación parabólica:  

  • (240)² = 4P x (110-10)
  • 57600 = 4P x 100
  • 57600 = 400P
  • 57600/400 = P
  • 144 = P
  • 200 x 200 = 4 x 144 x (Altura - 100)
  • 40000 = 576Altura - 57600
  • 40000 + 57600 / 576 = Altura
  • 169.4 metros = Altura

Por lo tanto, la altura es de 169.4 metros.

Aprende más en brainly.com/question/20333463

8 0
2 years ago
Which one? Sam Golbach or Colby Brock
Maru [420]
Sam all the way.....
5 0
3 years ago
Read 2 more answers
GG(ss) = 1 ss2 + 3 We want to design a feedback control system in a unity feedback structure by adding a controller DD(ss) = ss+
saw5 [17]

Answer:

Explanation:

The explanation is given in the picture that is shown below

3 0
3 years ago
Other questions:
  • Data becomes information when it is__________ in some way and made___________
    5·1 answer
  • Identify each statement as referring to a series or parallel circuit.
    15·1 answer
  • For a given set of input values, a NAND gate produces the opposite output as an OR gate with inverted inputs.A. True
    7·1 answer
  • The driver of a car traveling up a 2% grade at an initial speed V0 applied the brakes abruptly and the vehicle slid to a complet
    13·1 answer
  • Xyxyydfufggivivihogcufuf​
    6·1 answer
  • Why is the lubrication system of an internal combustion engine equipped with an oil filter?
    11·1 answer
  • In a website browser address bar, what does “www” stand for?
    9·1 answer
  • What issues does society try to forget in order to not have to deal with them ?
    6·1 answer
  • Need help please????????!!!!!!
    5·1 answer
  • Using your knowledge of how an ATM is used, develop a set of use cases that could serve as a basis for understanding the require
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!