2D Array Lab
Theater Pricing
Objective
Process data in a two-dimensional array and write methods to modify and display 2-D arrays.
Create a class named TheaterSeatingChart. The class should contain a data field that
...
2D Array Lab
Theater Pricing
Objective
Process data in a two-dimensional array and write methods to modify and display 2-D arrays.
Create a class named TheaterSeatingChart. The class should contain a data field that is a 2-D
array which holds the prices of the seats in the theater. Your class should not extend the Arrays
class! The theater owner will use your program to allow people to purchase seats.
The theater seating chart with ticket prices is presented below.
10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10
10 10 10 10 10 10 10 10 10 10
10 10 20 20 20 20 20 20 10 10
10 10 20 20 20 20 20 20 10 10
10 10 20 20 20 20 20 20 10 10
20 20 30 30 40 40 30 30 20 20
20 30 30 40 50 50 40 30 30 20
30 40 50 50 50 50 50 50 40 30
The owner of the theater will never change the number of rows or number of seats in a row.
Therefore, when you write your class, you also must create two additional data fields that are
constants. Each data field will represent the number of rows or number of columns in your
array. Give them a useful name so the reader of your program understands what these values
represent. Remember that, as a matter of convention, constant values are written in ALLCAPS,
tagged as "static final" and placed so that their scope is the scope of the whole driver class. The
ALLCAPS makes it easier for us to quickly read our own code. The "static" tag makes these
constant values accessible in both static and non-static methods (in both class and instance
methods). The "final" tag means that this value cannot be changed. A subsequent command
such as NUMITEMS = 15 would be illegal because of the final tag. The class scope makes
these constants visible from any method.
Your program should contain the following methods. Don’t forget, you can call instance
methods within other instance methods!
1) only one default constructor: to set the values of the elements in the array to the
prices listed above.
2) printSeatingChart: to print out a seating chart. The display must include prices, seat
numbers and row numbers as indicated in the output from the Driver class. The method
should also print out a legend that indicates what the values in the seating chart
represent
[Show More]