Answer:
The solution code is written in Java.
Explanation:
The method, bookSeat(), as required by the question is presented from Line 16 - 26 as part of the public method in a class Movie. This method take row, i, and column, j, 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 bookSeat() 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 totalSales (Line 19) and then set the price to 0 (Line 20) and return true since the ticket is successfully sold (Line 21). If it has already been sold, return false (Line 23).