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
A circular ceramic plate that can be modeled as a blackbody is being heated by an electrical heater. The plate is 30 cm in diame
MakcuM [25]

Answer:

Heater power = 425 watts

Explanation:

Detailed explanation and calculation is shown in the image below

6 0
3 years ago
Which of the following refers to software designed to alter system files and utilities on a victim’s system with the intention o
Oksi-84 [34.3K]
The answer is Rootkits.
6 0
3 years ago
Very thin films are usually deposited under vacuum conditions to prevent contamination and ensure that atoms can fly directly fr
katrin [286]

Answer:

a. 9947 m

b. 99476 times

c. 2*10^11 molecules

Explanation:

a) To find the mean free path of the air molecules you use the following formula:

\lambda=\frac{RT}{\sqrt{2}\pi d^2N_AP}

R: ideal gas constant = 8.3144 Pam^3/mol K

P: pressure = 1.5*10^{-6} Pa

T: temperature = 300K

N_A: Avogadros' constant = 2.022*10^{23}molecules/mol

d: diameter of the particle = 0.25nm=0.25*10^-9m

By replacing all these values you obtain:

\lambda=\frac{(8.3144 Pa m^3/mol K)(300K)}{\sqrt{2}\pi (0.25*10^{-9}m)^2(6.02*10^{23})(1.5*10^{-6}Pa)}=9947.62m

b) If we assume that the molecule, at the average, is at the center of the chamber, the times the molecule will collide is:

n_{collision}=\frac{9947.62m}{0.05m}\approx198952\  times

c) By using the equation of the ideal gases you obtain:

PV=NRT\\\\N=\frac{PV}{RT}=\frac{(1.5*10^{-6}Pa)(\frac{4}{3}\pi(0.05m)^3)}{(8.3144Pa\ m^3/mol\ K)(300K)}=3.14*10^{-13}mol\\\\n=(3.14*10^{-13})(6.02*10^{23})\ molecules\approx2*10^{11}\ molecules

5 0
3 years ago
When converting liquid level units to sensor output signal units, you should first convert the liquid level units to _____ units
dangina [55]
The answer is 2 because I just took the test!
7 0
2 years ago
25 In differential aeration corrosion, rich oxygenated parts are
sleet_krkn [62]

Answer:what are you trying to say

Explanation:

6 0
3 years ago
Other questions:
  • Policy makers in the U.S. government have long tried to write laws that encourage growth in per capita real GDP. These laws typi
    6·1 answer
  • A closed system undergoes a process in which work is done on the system and the heat transfer Q occurs only at temperature Tb. F
    8·1 answer
  • Tim was recently released from his last job. He was very rigid and would not change a product design once he began a project. He
    7·1 answer
  • Use the map to complete the table by selecting the boxes that best describe how ocean currents affect the
    14·1 answer
  • Air in a 10 ft3 cylinder is initially at a pressure of 10 atm and a temperature of 330 K. The cylinder is to be emptied by openi
    10·2 answers
  • 1)A wheel is used to turn a valve stem on a water valve. If the wheel radius is 1 foot and the stem, (axle), radius is .5 inches
    10·1 answer
  • What differentiates the master builder approach prior to the Renaissance from later approaches? Projects do not depend on indivi
    14·1 answer
  • GMA MIG weiding is a
    7·1 answer
  • It is better to know or not to know?​
    6·2 answers
  • How many meters per second is 100 meters and 10 seconds
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!