Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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.
Step by Step Solution
★★★★★
3.49 Rating (176 Votes )
There are 3 Steps involved in it
Step: 1
Java programming implementing the above two methods import javautil public class SlothConcert public ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started