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
When you approach an uncontrolled intersection, you should treat it as though which sign is present?
Vika [28.1K]

Answer: A yield sign

Explanation:

6 0
2 years ago
A civil engineer is asked to design a curved section of roadway that meets the following conditions: With ice on the road, when
lianna [129]

Answer:

1. 3.4^{o}

2. 163.3 m

Explanation:

Static friction between road and rubber, μs =0.06

The maximum speed of the car, v = 50 km/h

                                              = (50)(1000/3600) m/s

                                               = 13.89 m/s

The acceleration due to gravity, g = 9.81 m/s^{2}

The frictional force, f = μsN     ...... (1)

The component mg cosθ which balance the normal reaction N

The component mg sinθ acts in an opposite direction to the frictional force f.

        ΣF = mg sinθ-f = 0      ...... (2)

Substitute the equation (1) in equation (2), we get

 ΣF = mgsinθ-μsN = 0

 mgsinθ-μsmgcosθ =0

 μs = sinθ/cosθ

   tanθ = μs

    θ = tan-1( μs) = tan-1(0.06) = 3.4^{o}

(b)The vertical component of the force is

N cosθ = fsinθ+mg

 N cosθ = μsNsinθ+mg

N[cosθ- μs sinθ] = mg     ...... (3)

The horizontal component of the force along the motion of the car is

Nsinθ+fcosθ = ma  (Centripetal acceleration, a = \frac {v^{2}}{r}

  Nsinθ+fcosθ = m(\frac {v^{2}}{r})

   Nsinθ+μsNcosθ = m(\frac {v^{2}}{r})

N[sinθ+μs cosθ] = m(\frac {v^{2}}{r})     ...... (4)    

Dividing the equation (4) with equation (3),

 [sinθ+μscosθ]/[cosθ- μs sinθ] = \frac {v^{2}}{rg}

 cosθ[sinθ/cosθ+μs]/cosθ[1- μs sinθ/cosθ] =\frac {v^{2}}{rg}

[tanθ+μs]/[1-μs tanθ] = \frac {v^{2}}{rg}      

 From part (1), tanθ = μs

 Then the above equation becomes

 \frac {(\mu_s+\mu_s]}{[1-\mu_s^{2}]} =\frac {v^{2}}{rg}

\frac {(2\mu_s]}{[1-\mu_s^{2}]} =\frac {v^{2}}{rg}

Therefore, the minimum radius of the curvature of the curve is

               r = \frac {v^{2}}{{2 \mu_s/[1-\mu_s^{2}]}g} 

                   = \frac {v^{2}[1-\mu_s^{2}]}{2\mu_s g}

                   = \frac {(13.89 m/s)^{2}[1-(0.06)^{2}]}{(2)(0.06)(9.81)}

                 = 163.3 m

5 0
3 years ago
Electrical circuits must be locked-out/tagged-out before electricians work on any equipment. Is this true or false?
dybincka [34]

Answer:

true

Explanation:

Equipment that are "locked-out/tagged-out" <em>prevent the electrician from being electrocuted</em> or attaining a serious injury in relation to it. Locking out an equipment prevents it from releasing its energy because such energy can be <em>hazardous</em> to the electrician. There are instances when the equipment accidentally starts up, thus, it is essential that the equipment's source of energy is<em> isolated.</em>

8 0
3 years ago
Blank is a measure of the amount of matter in a given amount of space
madam [21]

  Hope this helps you buddy!!!!! :}

Mass The measure of the amount of matter in an object.

5 0
2 years ago
2.4: Add a method called setValue(), and the description of setValue is: public int setValue(long searchKey) In this method, the
Yanka [14]

Answer:

Below is java code that must be used for the given question:

// highArray.java

// demonstrates array class with high-level interface

// to run this program: C>java HighArrayApp

////////////////////////////////////////////////////////////////

class HighArray

  {

  private long[] a;                 // ref to array a

  private int nElems;               // number of data items

  //-----------------------------------------------------------

  public HighArray(int max)         // constructor

     {

     a = new long[max];                 // create the array

     nElems = 0;                        // no items yet

     }

  //-----------------------------------------------------------

  public setValue find(long searchKey)

     {                              // find specified value

     int j;

     for(j=0; j<nElems; j++)            // for each element,

        if(a[j] == searchKey)           // found item?

           break;                       // exit loop before end

     if(j == nElems)                    // gone to end?

        return false;                   // yes, can't find it

     else

        return true;                    // no, found it

     }  // end find()

  //-----------------------------------------------------------

  public void insert(long value)    // put element into array

     {

     a[nElems] = value;             // insert it

     nElems++;                      // increment size

     }

  //-----------------------------------------------------------

  public void display()             // displays array contents

     {

     for(int j=0; j<nElems; j++)       // for each element,

        System.out.print(a[j] + " ");  // display it

     System.out.println("");

     }

  //-----------------------------------------------------------

  }  // end class HighArray

////////////////////////////////////////////////////////////////

class HighArrayApp

  {

  public static void main(String[] args)

     {

     int maxSize = 100;            // array size

     HighArray arr;                // reference to array

     arr = new HighArray(maxSize); // create the array

     arr.insert(77);               // insert 10 items

     arr.insert(99);

     arr.insert(44);

     arr.insert(55);

     arr.insert(22);

     arr.insert(88);

     arr.insert(11);

     arr.insert(00);

     arr.insert(66);

     arr.insert(33);

     arr.display();                // display items

     int searchKey = 35;           // search for item

     if( arr.find(searchKey) )

        System.out.println("Found " + searchKey);

     else

        System.out.println("Can't find " + searchKey);

     }  // end main()

  }  // end class HighArrayApp

Explanation:

6 0
3 years ago
Other questions:
  • A evolução da malha rodoviária do Brasil é um marco notável
    9·1 answer
  • A block is sliding on a level surface of varying materials, and so its effective coefficient of friction is variable, 0.1t, wher
    6·1 answer
  • Which of the following is an example of an iterative process?
    12·1 answer
  • Suppose that we have a 1000 pF parallel-plate capacitor with air dielectric charged to 1000 V. The capacitors terminals are open
    13·1 answer
  • Discuss the ethics of the circumstances that resulted in the Columbia shuttle disaster. Considering the predictions that were ma
    5·1 answer
  • I want to explain what 2000 feet looks like to young children so that they can imagine it in class
    12·1 answer
  • Many of the products that we eat and drink are advanced manufactured products. Is this statement TRUE or FALSE?
    12·1 answer
  • Consider a building whose annual air-conditioning load is estimated to be 40,000 kWh in an area where the unit cost of electrici
    8·1 answer
  • Is the science of measurement
    13·2 answers
  • How to do this goalookr goalookr
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!