Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Please follow the instructions. The Theater.Java file code has been copy pasted at the bottom. This code here will have more instructions. Please copy

JAVA Please follow the instructions. The Theater.Java file code has been copy pasted at the bottom.

image text in transcribed

This code here will have more instructions. Please copy paste the code into a file and go from there. Thank you!

Theater.java:

public class Theater { /* * This method should return true if the row and column passed in are * valid for the String array named seats (the row and column are within the array). * You are guaranteed that the seats array has at least 1 row. * All rows in the seats array have the same number of columns. */ public static boolean isSeatInTheater(int row, int col, String[][] seats) { return false; } /* * This method should return true if the customer directly in front of * the customer at row, col is someone more than 3 units taller than them. * A customer is front of another if they are in the same column but one * row greater. * Remember that row 0 is at the back of the theater. The front of the * theater is the last row in the array. * A height of -1 means there is no customer in the seat. */ public static boolean shouldCustomerBeMoved(int row, int col, int [][]heights) { return false; } /* * This method should return the row number with the greatest number of occupied seats. * If a seat is empty it will contain "" (an empty string), otherwise it will contain the name of * the customer sitting there. */ public static int findMostOccupiedRow(String [][] names) { return -1; } /* * This method should go through the array of seats and return how many seats are free (empty). * If a seat is empty the array at that row column will contain "" (an empty string). * * This method should return the number of free seats. */ public static int getNumberOfFreeSeats(String [][] seats) { return -1; } /* * This method should return the name of the tallest customer in the theater. * The row/col in the array of heights corresponds to the row/col of the name * of each customer. * The arrays are guaranteed to be the same size. */ public static String getTallestCustomer(int [][] heights, String [][] names) { return null; } /* * This method searches the theater for a place to put a new customer. * It searches an entire row before moving to the next row. * i.e. It starts at row 0, column 0, then moves to row 0, column 1, and does not move to row 1 until it has searched * all of row 0. * A height of -1 in the heights array, or a name of "" in the names array means there is no customer in a seat (you * do not have to check for both conditions). * * When it finds an empty seat, it puts the customer there if: * the customer is not more than 3 units taller than the alien in the seat behind (row - 1) the empty seat and * the alien in front of that seat (row + 1) is not more than three units taller than the customer. * * To place a customer, change the heights and names arrays to hold the customer's height and name. * Return true if a seat was found for the customer (the arrays were changed). * Return false otherwise. * * */ public static boolean putCustomerInEmptySeat(String name, int height, int [][] heights, String[][]names) { return false; } /** * This method returns the average height of all the patrons in the theater. * If you get an error that says you returned NaN it means you divided by zero. */ public static double getAverageHeight(int [][] heights) { return 0.0; } /** * This method should first compute the average height, and then it should go through * the array of heights and create a space separated String with all of the names of customers with heights * that are above average. * You are allowed to have a trailing space. * Example for this input (heights are in parenthesis) * This is the input (heights are in parenthesis): * col 0 | col 1 | col 2 | col 3 | col 4 | col 5 | col 6 | col 7 | col 8 * ------------------------------------------------------------------------------------------------------------------------------------------------------ * row 0 [ Qbycaj(81) | Plfnc(26) | Qkome(35) | (-1) | Smilreqoh(83) | Awvnmloiw(43) | (-1) | Cgaaa(100) | Blaladl(99) ] * * The average height is 66.71428571428571 (so if your getAverageHeight doesn't yet work, don't try this method). * The expected return string is: * " Qbycaj Smilreqoh Cgaaa Blaladl" * OR * "Qbycaj Smilreqoh Cgaaa Blaladl "   Alien Theater Complete this programming project using your notes, the textbook, or any in-class sources you like. You may also use on-line resources as long as they are not direct solutions to the problem (i.e. you can use online resources to look up the Math library, but not to find java code that calculates a circle's circumference). Your work must be your own, you may ask a friend to look over your work, or discuss procedural decomposition with you, but you must write all of the code on your own. If another student asks for assistance, look at their code, but do not show them yours. Step 1: In Eclipse, create a new Java Project named Alien Theater Step 2: Download and copy Theater.java into the src folder of your Alien Theater project. Step 3: Download and copy Theater Tests.java into the src folder of your Alien Theater project. If the download and copy does not work, you can create two new classes in your project Theater and Theater Tests. Then you can open the files on Google classroom and copy and paste their contents into your classes. DO ALL OF YOUR WORK IN Theater.java! As you complete each method, open Theater Tests and run it to check your results. You can comment out the tests you aren't ready to run yet in the main of Theater Tests, and then add them back in as you go. Problem Description You are going to create a few methods for someone managing an alien theater. What's the difference between an alien theater and a regular theater? Row O is the back of the theater instead of the front. Also, the names are random letters. The individual methods you have to create are described in Theater Methods.java

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

3. Provide advice on how to help a plateaued employee.

Answered: 1 week ago

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago