![](/uploads/1/2/7/6/127640419/597158990.jpg)
View detailed seating charts and maps for Jammin Java with row numbers. Theater Seating 2D Array passing through function. I'm supposed to write a program that displays a theater seating, ask the user to give each row a price, then ask if they want to purchase a ticket. Their response has to be saved into a 2d array and change the EMPTY seat to a TAKEN seat. Puli mp3 songs free download starmusiq. //array to hold seat chart for(int i= 0;i.
PermalinkJoin GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
ECLER DPA1000 is a stereo amplifier delivering 2 x 440WRMS @ 4 Ω, and ready to drive 2Ω loudspeaker loads (4 x 8 Ω loudspeakers in parallel, per channel). It features ECLER's SPM proprietary technology and optional in-bay ALMAcard DSP module. A top-notch amplifier, very suitable for the high end installation. Ecler dpa-1000 schematic.
Sign upBranch:master
Find file Copy path
Fetching contributors…
importjava.util.ArrayList; |
importjava.util.List; |
publicclassSeatingChart { |
/** seats[r][c] represents the Student in row r and column c in the classroom */ |
privateStudent[][] seats; |
/** Creates a seating chart with the given number of rows and columns from the students in |
* studentList. Empty seats in the seating chart are represented by null. |
* @param rows the number of rows of seats in the classroom |
* @param cols the number of columns of seats in the classroom |
* Precondition: rows > 0; cols > 0; |
* rows * cols >= studentList.size() |
* Postcondition: |
* - Students appear in the seating chart in the same order as they appear |
* in studentList, starting at seat[0][0]/ |
* - seats is filled column by column from studentList, followed by any |
* empty seats (represented by null). |
* - studentList is unchanged. |
* |
*/ |
publicSeatingChart(List<Student>studentList, introws, intcols) { |
/* to be implemented in part (a) */ |
seats =newStudent[rows][cols]; |
int position =0; |
for (int c =0; c < seats[0].length; c++) { |
for (int r =0; r < seats.length; r++) { |
if (position < studentList.size()) { |
seats[r][c] = studentList.get(position); |
position = position +1; |
} |
} |
} |
} |
/** Removes students who have more than a given number of absence from the |
* seating chart, replacing those entries in the seating chart with null |
* and returns the number of students removed. |
* @param allowedAbsences an integer >= 0 |
* @return number of students removed from seats |
* Postcondition: |
* - All students with allowedAbsences or fewer are in their original position in seats. |
* - No students in seats has more than allowedAbsences absences. |
* - Entries without students contain null. |
* |
*/ |
publicintremoveAbsentStudents(intallowedAbsences) { |
/* to be implemented in part (b) */ |
int count =0; |
for (int r =0; r < seats.length; r++) { |
for (int c =0; c < seats[r].length; c++) { |
if (seats[r][c] !=null&& seats[r][c].getAbsenceCount() > allowedAbsences) { |
count = count +1; |
seats[r][c] =null; |
} |
} |
} |
return0; |
} |
/** |
* INCLUDED FOR TESTING |
*/ |
publicStringtoString(){ |
String seatingPlan =''; |
for (int r =0; r < seats.length; r++){ |
for (int c =0; c < seats[r].length; c++) { |
if (seats[r][c] !=null) |
seatingPlan = seatingPlan + seats[r][c].getName()+','+seats[r][c].getAbsenceCount()+'t|t'; |
else |
seatingPlan = seatingPlan +'nullt|t'; |
} |
seatingPlan = seatingPlan +'n'; |
} |
return seatingPlan; |
} |
publicstaticvoidmain(String[] args) { |
// TODO Auto-generated method stub |
List<Student> roster =newArrayList<Student>(); |
roster.add(newStudent('K',3)); |
roster.add(newStudent('L',1)); |
roster.add(newStudent('P',4)); |
roster.add(newStudent('L',1)); |
roster.add(newStudent('H',5)); |
roster.add(newStudent('R',9)); |
roster.add(newStudent('G',2)); |
roster.add(newStudent('F',6)); |
roster.add(newStudent('D',1)); |
roster.add(newStudent('D',3)); |
SeatingChart seatingChart =newSeatingChart(roster,3,4); |
System.out.println(seatingChart); |
seatingChart.removeAbsentStudents(4); |
System.out.println(''); |
System.out.println(seatingChart); |
} |
} |
![Java Java](/uploads/1/2/7/6/127640419/720884372.jpg)
Copy lines Copy permalink
![](/uploads/1/2/7/6/127640419/597158990.jpg)