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]
4 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]4 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
An inventor claims to have developed a refrigerator that at steady state requires a net power input of 1.1 horsepower to remove
Lynna [10]

Answer:

The inventor's claim is false in the sense that no thermal machine can violate the first thermodynamic law.

Explanation:

The inventor's claim could not be possible as no thermal machine can transfer more heat than the input work consumed. If we expose the thermal efficiency:

n=Q out / W in

Where Q and W both must be in the same power unit, so we will convert the remove heat from BTU/hr to hp:

12000 BTU/hr = 4.72 hp

Therefore by comparing, we notice that the removing heat of 4.75 hp is large than the delivered work of 1.11 hp. By evaluating the efficiency:

[tex]n=4.75 hp / 1.1 hp  = 4.3 > 1[/tex]

6 0
3 years ago
Each of the following activities are commonly performed during the implementation of the Database Life Cycle (DBLC). Fill in the
kicyunya [14]
Yessiree I agree with yu cause yu are right
4 0
3 years ago
Oil enters a counterflow heat exchanger at 600 K with a mass flow rate of 10 kg/s and exits at 200 K. A separate stream of liqui
Elis [28]

Answer:

The minimum mass flow rate for the water is 14.39kg/s

Explanation:

In this question, we are asked to calculate the minimum mass flow rate for the water in kg/s.

Please check attachment for complete solution and step by step explanation

7 0
3 years ago
Sasha is using Python 3 as a calculator to divide 100 by 4 and types print 100 / 4. When run is typed, nothing happens. What nee
Nady [450]

Answer:

parentheses

Explanation:

print 100/4

SyntaxError: Missing parentheses in call to 'print'.

print (100/4)

25.0

You need parentheses with print statements in python.

Hope this helps!

7 0
3 years ago
What is differences Between hard shoulder &amp; soft shoulder in civil Engineerin?
r-ruslan [8.4K]

Answer:

<em><u>The 'shoulder' of a road is the land to the edge of the road. On most roads without pavements, the shoulder is a strip of grass or a hedgerow. This is known as a 'soft shoulder'. On a motorway, this strip of land is hardstanding, hence the name 'hard shoulder.'</u></em>

<em><u>Mark</u></em><em><u> </u></em><em><u>as</u></em><em><u> brilliant</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u> </u></em>

5 0
4 years ago
Other questions:
  • What software do you sue for design and the rapid prototyping machine?
    11·1 answer
  • Isn't this website cheating?
    10·2 answers
  • At audio frequencies (below 20kHz), electromagnetic waves have very ____ wavelengths. The wavelength is typically much larger th
    12·1 answer
  • 50. You are not permitted to work on any equipment or machinery at any time if the
    13·1 answer
  • The pressure distribution over a section of a two-dimensional wing at 4 degrees of incidence may be approximated as follows: Upp
    9·1 answer
  • Two kilograms of air in a piston-cylinder assembly undergoes an isothermal
    11·1 answer
  • A customer got debited twice, how would you investigate and resolve this conflict on the customer side and on the company side?
    5·1 answer
  • Wheel diameter 150 mm, and infeed 0.06 mm in a surface grinding operation. Wheel speed 1600 m/min, work speed 0.30 m/s, and cros
    14·1 answer
  • Cat is stuck in 10 foot hole how do i get it unstuck
    13·2 answers
  • Please help me please
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!