The world-renowned sloth cellist Lento Con Brio is planning to make a much-anticipated return to the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
The world-renowned sloth cellist Lento Con Brio is planning to make a much-anticipated return to the concert stage after this whole coronavirus situation is over! The sloth strongly dislikes Ticketmaster and its exorbitant fees, so you've been hired to write some custom ticketing software for the upcoming concert. The concert hall is a rectangular grid of scats. You want to divide the scats into three sections (premium, standard, and cconomy) based on distance from the stage. Each section contains a certain number of rows, and the tickets cost more as you get closer to the stage. The classifications into premium, standard, and cconomy rows are flexible – they can be changed to affect how much revenue is generated from the concert. To keep track which tickets have been sold, you will use a 2D array of boolean values, where each 1 clement represents one scat in the concert hall. A value of true indicates that the scat has been sold, and a value of false indicates that the scat is still available. Within your Lab7HW folder, create a new class named SlothConcert. 1. (6 pts) Within the SlothConcert class, write a method named showSeats that takes three param- eters: • A 2D array of boolean values indicating which scats have been sold • How many row(s) should be classified as premium scats. These are the first row(s) in the array. How many row(s) should be classified as standard scats. These are the next rOw (s) in thc array. You may assume that the array is rectangular and non-empty, the number of premium and standard rows are non-negative, and the combined number of premium and standard rows do not exceed the number of rows in the array. (Note that although the number of cconomy rows is not specified, it can be computed simply by subtracting the number of premium and standard rows from the total number of rows.) The showSeats method should show a text representation of the scats in the concert hall, one row of scats per linc. Use * to indicate a sold scat, P to indicate an unsold premium scat, S to indicate an unsold standard seat, and E to indicate an unsold economy seat. For example, suppose seats is the 2D boolean array { {false, false, true}, {true, false, true}, {true, false, true}, {true, true, false} }. Then calling showSeats(seats, 1, 2) should print the following: PP* *S* *S* **E 2. (7 pts) Out of an abundance of caution, the concert hall has decided to institute a social distancing policy at the event. Specifically, every sold seat cannot have another sold seat immediately to the left, right, ahcad, or behind. Having another sold scat diagonally adjacent is OK, however. This has the added benefit of not blocking anyone's line of sight to the stage - a stroke of genius, truly. (Except for the fact that this drastically cuts into ticket revenue, but let's not worry about that here.) For example, this configuration of sold seats is OK (where indicates a sold seat and - indicates an empty seat): --* However, this one is not OK duc to the upper left corner: Within the SlothConcert class, write a method named isProperlyDistanced that takes a 2D boolean array as a parameter. You may assume that the array is rectangular and non-empty. This method should return whether or not the social distancing guidelines described above are met. The world-renowned sloth cellist Lento Con Brio is planning to make a much-anticipated return to the concert stage after this whole coronavirus situation is over! The sloth strongly dislikes Ticketmaster and its exorbitant fees, so you've been hired to write some custom ticketing software for the upcoming concert. The concert hall is a rectangular grid of scats. You want to divide the scats into three sections (premium, standard, and cconomy) based on distance from the stage. Each section contains a certain number of rows, and the tickets cost more as you get closer to the stage. The classifications into premium, standard, and cconomy rows are flexible – they can be changed to affect how much revenue is generated from the concert. To keep track which tickets have been sold, you will use a 2D array of boolean values, where each 1 clement represents one scat in the concert hall. A value of true indicates that the scat has been sold, and a value of false indicates that the scat is still available. Within your Lab7HW folder, create a new class named SlothConcert. 1. (6 pts) Within the SlothConcert class, write a method named showSeats that takes three param- eters: • A 2D array of boolean values indicating which scats have been sold • How many row(s) should be classified as premium scats. These are the first row(s) in the array. How many row(s) should be classified as standard scats. These are the next rOw (s) in thc array. You may assume that the array is rectangular and non-empty, the number of premium and standard rows are non-negative, and the combined number of premium and standard rows do not exceed the number of rows in the array. (Note that although the number of cconomy rows is not specified, it can be computed simply by subtracting the number of premium and standard rows from the total number of rows.) The showSeats method should show a text representation of the scats in the concert hall, one row of scats per linc. Use * to indicate a sold scat, P to indicate an unsold premium scat, S to indicate an unsold standard seat, and E to indicate an unsold economy seat. For example, suppose seats is the 2D boolean array { {false, false, true}, {true, false, true}, {true, false, true}, {true, true, false} }. Then calling showSeats(seats, 1, 2) should print the following: PP* *S* *S* **E 2. (7 pts) Out of an abundance of caution, the concert hall has decided to institute a social distancing policy at the event. Specifically, every sold seat cannot have another sold seat immediately to the left, right, ahcad, or behind. Having another sold scat diagonally adjacent is OK, however. This has the added benefit of not blocking anyone's line of sight to the stage - a stroke of genius, truly. (Except for the fact that this drastically cuts into ticket revenue, but let's not worry about that here.) For example, this configuration of sold seats is OK (where indicates a sold seat and - indicates an empty seat): --* However, this one is not OK duc to the upper left corner: Within the SlothConcert class, write a method named isProperlyDistanced that takes a 2D boolean array as a parameter. You may assume that the array is rectangular and non-empty. This method should return whether or not the social distancing guidelines described above are met.
Expert Answer:
Answer rating: 100% (QA)
Java programming implementing the above two methods import javautil public class SlothConcert public ... View the full answer
Related Book For
Financial Institutions Management A Risk Management Approach
ISBN: 978-0071051590
8th edition
Authors: Marcia Cornett, Patricia McGraw, Anthony Saunders
Posted Date:
Students also viewed these law questions
-
If the (inverse) demand function for a monopoly's product is: p=121-5q then the firm's marginal revenue function is a. MR= 121-5q b. MR= 121-10q c. MR= 605-q d. MR=242-10q
-
The Multifactor Arbitrage Pricing Theory (APT hereafter) is an elegant theory of how exposure to systematic risk factors should affect expected returns. a). What are the advantages of the APT...
-
A bank is planning to make a loan of $5,000,000 to a firm in the steel industry. It expects to charge a servicing fee of 50 basis points. The loan has a maturity of 8 years with a duration of 7.5...
-
Kiki purchases a $16,000 bond from Green Corp. on January 1, 2021. The bond has a 10% annual interest rate. On December 1, 2021, Kiki gifts the bond to her son, Branson. How much income is reported...
-
A natural monopoly exists in an industry with a demand schedule P = 100 - Q. The marginal revenue schedule is then MR = 100 - 2Q. The monopolist operates with a fixed cost F, and a total variable...
-
Given the following 16-bit control words for the datapath of Figure 8-11, determine (a) the microoperation that is executed and (b) the change in the contents of the register for each control word...
-
Joyce Company adopts a defined benefit plan for its employees as a post-retirement benefit. According to the plan and the actuarial assumptions, the pension expense is NT\($200,000,\) and Joyce only...
-
(Multi-step Income, Retained Earnings) Presented below is information related to American Horse Company for 2004. Prepare a multi-step income statement and a retained earnings statement. American...
-
You are planning to retire in 30 years. You want to be able to spend $40,000 per year in retirement, adjusted for inflation (so you will spend the equivalent in each year of $40,000 in today's...
-
On the geologic map in Fig. G-1 (Appendix G) draw the correct strike and dip symbol in each circle to indicate the attitude of Formation B and each dike. To verify your attitude symbols, Fig. G-2 can...
-
Service Company Lawn RX, Inc. provides a quarterly lawn care service that is sold for $140. The variable and fixed cost data are as follows: $ Direct labor 80.00 Overhead: Variable cost per unit 5.00...
-
Key points on budgeting planning and spending from the finance point of view. A brief explanation of these points?
-
what is organizational change? 2) what are the environmental factors of change? 3)explain about each role of organizational change: change initiators, change implementers, change facilitators, change...
-
What are three important cost considerations that a company should review when making decisions around outsourcing?
-
Waterways is thinking of mass-producing one of its special-order sprinklers. To do so would increase unit variable costs for all sprinklers by an average of $0.60. The company also estimates that...
-
For a residential building project, the developer has estimated the capital investment, net rental revenue, and resale value after 6 years for the following three scenarios. Given the developer's...
-
McDermott Inc. signed a $100,000, three-year, note payable with interest of 6% on July 1, 2023. The principal and interest will be paid at the end of term on June 30, 2026. How much interest expense...
-
The value of a share of common stock depends on the cash flows it is expected to provide, and those flows consist of the dividends the investor receives each year while holding the stock and the...
-
How do the asset and liability structures of a savings institution compare with the asset and liability structures of a commercial bank? How do these structural differences affect the risks and...
-
If an investor observes that the price of a stock trading in one exchange is different from the price in another exchange, what form of arbitrage is applicable, and how can the investor participate...
-
What is the minimum risk portfolio? Why is this portfolio usually not the portfolio chosen by FIs to optimize the return-risk tradeoff?
-
(a) Express the magnitude of the electric field inside the strip in Figure 27.43 in terms of the width \(w\) of the strip and the potential difference \(V_{\mathrm{RL}}\). (b) Given the magnitude...
-
A compass sits on a table with its needle pointing to Earth's North Pole. A bar magnet with its long axis oriented along an east-west line is brought toward the compass from the east. If the needle...
-
Explain why the \(1 / r\) dependence expressed in Eq. 27.38 is consistent with the symmetry of the wire causing the magnetic field. B = = 2kI rco 2k I (27.38) &
Study smarter with the SolutionInn App