generated from nighthawkcoders/student_2025
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
2021 FRQ:
public class CombinedTable {
private SingleTable table1;
private SingleTable table2;
public CombinedTable(SingleTable table1, SingleTable table2) {
this.table1 = table1;
this.table2 = table2;
}
public boolean canSeat(int numPeople) {
return numPeople <= (table1.getNumSeats() + table2.getNumSeats() - 2);
}
public double getDesirability() {
double viewQuality1 = table1.getViewQuality();
double viewQuality2 = table2.getViewQuality();
if (table1.getHeight() == table2.getHeight()) {
return (viewQuality1 + viewQuality2) / 2;
} else {
return (viewQuality1 + viewQuality2) / 2 - 10;
}
}
}
Takes two SingleTable objects as arguments and stores them in the table1 and table2 instance variables.
Calculates the total seating capacity of the combined table as the sum of the seating capacities of the individual tables minus 2.
Retreiveds from table
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels