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
What kind of value should an employee possess when employees are expected to be responsible and fair?
jasenka [17]

Answer:

E self-confidence

Explanation:

6 0
3 years ago
Lately, you have noticed some repetitive stress in your wrist. Which sign is most likely the cause of that stress and pain?
Cerrena [4.2K]
1, you might have been carrying things that are way too heavy for you.
2, you might have weak tendons.
3 0
3 years ago
The Accenture team is involved in helping a client in the transformation journey using Cloud computing. How is myNav beneficial
professor190 [17]

Answer:

It helps ensure the security of client data.

Explanation:

Cloud computing is one of the security features in networking which is being adopted by big corporations and organizations inorder to ensure smooth running of the organization.

Also, due to the sensitivity of data which some organizations deals in, they tried everything possible to protect themselves and their clients' information through use of cloud computing.<em> Data are stored in the clouds, and requires special administrative rights for it to be accessed by some of the staffs working in any given organization.</em>

8 0
2 years ago
Why it is important to prepare first the materials and tools carpentry before doing the tasks?​
professor190 [17]

Answer:

It is important to inspect and check materials and tools for defects and damage before receiving them so that you can ask for replacements for those that you found .

Explanation:

8 0
2 years ago
Read 2 more answers
A pressure gage at the inlet to a gas compressor indicates that the gage pressure is 40.0 kPa. Atmospheric pressure is 1.01 bar.
bonufazy [111]

Answer:

Given

inlet Pga =40kpa = 40000pa

Patm=1.01bar = 1.01 x 100000pa =101000pa

exit Pab= 6.5 (inlet Pab)

But generally, Pab = Patm + Pga

1. the absolute pressure of the gas at the inlet, inlet Pab?

inlet Pab = Patm + inlet Pga

            = 101000pa + 40000pa = 141kpa

the absolute pressure of the gas at the inlet, inlet Pab = 141kpa

2. the gage pressure of the gas at the exit? exit Pga?

exit Pab = Patm + exit Pga

exit Pga = exit Pab - Patm

             = (6.5 x 141kpa) - 101kpa

              = 815.5kpa

the gage pressure of the gas at the exit exit Pga=815.5kpa

5 0
3 years ago
Other questions:
  • What is a construction worker with limited skills called?
    12·1 answer
  • Determine the direct runoff and streamflow given the following unit hydrograph. The rainfall is collected at 4-hour intervals an
    14·1 answer
  • The flatbed truck carries a large section of circular pipe secured only by the two fixed blocks A and B of height h. The truck i
    14·2 answers
  • Overview In C, a string is simply an array of characters. We have used literal strings all along – the stuff in between the quot
    11·1 answer
  • Which engineers are requried to have a PE (professional engineer) license?
    13·2 answers
  • A 0.39 percent Carbon hypoeutectoid plain-carbon steel is slowly cooled from 950 oC to a temperature just slightly below 723 oC.
    15·1 answer
  • Helium gas expands in a piston-cylinder in a polytropic process with n=1.67. Is the work positive, negative or zero?
    8·1 answer
  • The traffic lights are not functioning.
    7·1 answer
  • I wuv little space :)
    8·1 answer
  • A particular electromagnetic wave travelling in vacuum is detected to have a frequency of 3 × 10 12 Hz. How much time will it ta
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!