} } 1. The following two classes are used to help solve part A and B of this problem. } } /**The class SingleTable represents a table at a restaurant.*/ public class SingleTable { /** SingleTable has a zero parameter constructor */ public SingleTable () { /implementation not shown */ /** Returns the number of seats at this table. The value is always greater or equal to 4. */ public int getNumSeats () { /* implementation not shown */ /** Returns the height of this table in centimeters. */ public int getHeight() { /* implementation not shown */ /** Returns the quality of the view from this table */ public double getViewQuality() { } /** implementation not shown */ /** Sets the quality of the view from this table */ public void setViewQuality (double quality) { /** implementation not shown */ //there may be other constructors, fields, methods not shown /**Restaurant represents all the tables at a restaurant*/ public class Restaurant ( public ArrayList tableList; //there may be other constructors, fields, methods not shown /** Calculates and returns the average view quality of all of the tables in the tableList field */ public double getAverageView() { } /** implementation not shown */ Part A) Write a complete class CombinedTable that extends SingleTable This class represents a table that has been made by combining two single tables together. In order to get full credit, your class must contain the following: . . A constructor that takes two Single Tables as Parameters o You should store these paramters as private class fields An override of getNumSeats - A combined table can seat a number of customers that is two fewer than the total number of seats in its two SingleTableObjects (to account for seats lost when the tables are pushed together). . An override of getViewQuality o If the two tables are the same height, the view quality is the average of the view quality of the two single table. o If the two tables are not the same height, the view quality is 10 units less than the average view quality of the two single tables. Part B) Write the getAverageView method from the Retaurant class.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Alert dont submit AI generated answer.

Free Respons question Practice from CSA. I need help.
 
}
}
1. The following two classes are used to help solve part A and B of this problem.
}
}
/**The class SingleTable represents a table at a restaurant. */
public class SingleTable {
/** SingleTable has a zero parameter constructor */
public SingleTable () {
/* implementation not shown */
/** Returns the number of seats at this table.
* always greater or equal to 4. */
public int getNumSeats () {
/* implementation not shown */
The value is
smalala msino tate admsmo how way to Us world acoll
/** Returns the height of this table in centimeters. */
public int getHeight() {
/* implementation not shown */
/** Returns the quality of the view from this table */
public double getViewQuality() {
/** implementation not shown */
Part A) Write a complete class CombinedTable that extends SingleTable
This class represents a table that has been made by combining two single tables together. In
order to get full credit, your class must contain the following:
•
.
A constructor that takes two Single Tables as Parameters
。 You should store these paramters as private class fields
An override of getNumSeats - A combined table can seat a number of customers that is
two fewer than the total number of seats in its two SingleTableObjects (to account for
seats lost when the tables are pushed together).
• An override of getViewQuality
o
If the two tables are the same height, the view quality is the average of the view
quality of the two single table.
o If the two tables are not the same height, the view quality is 10 units less than the
average view quality of the two single tables.
Part B) Write the getAverage View method from the Retaurant class.
}
/** Sets the quality of the view from this table */
public void setViewQuality (double quality) {
}
/** implementation not shown */
//there may be other constructors, fields, methods not shown
/**Restaurant represents all the tables at a restaurant*/
public class Restaurant {
public ArrayList<SingleTable> tableList;
//there may be other constructors, fields, methods not shown
/** Calculates and returns the average view quality of all of the
* tables in the tableList field */
public double getAverageView() {
/** implementation not shown */
}
Transcribed Image Text:} } 1. The following two classes are used to help solve part A and B of this problem. } } /**The class SingleTable represents a table at a restaurant. */ public class SingleTable { /** SingleTable has a zero parameter constructor */ public SingleTable () { /* implementation not shown */ /** Returns the number of seats at this table. * always greater or equal to 4. */ public int getNumSeats () { /* implementation not shown */ The value is smalala msino tate admsmo how way to Us world acoll /** Returns the height of this table in centimeters. */ public int getHeight() { /* implementation not shown */ /** Returns the quality of the view from this table */ public double getViewQuality() { /** implementation not shown */ Part A) Write a complete class CombinedTable that extends SingleTable This class represents a table that has been made by combining two single tables together. In order to get full credit, your class must contain the following: • . A constructor that takes two Single Tables as Parameters 。 You should store these paramters as private class fields An override of getNumSeats - A combined table can seat a number of customers that is two fewer than the total number of seats in its two SingleTableObjects (to account for seats lost when the tables are pushed together). • An override of getViewQuality o If the two tables are the same height, the view quality is the average of the view quality of the two single table. o If the two tables are not the same height, the view quality is 10 units less than the average view quality of the two single tables. Part B) Write the getAverage View method from the Retaurant class. } /** Sets the quality of the view from this table */ public void setViewQuality (double quality) { } /** implementation not shown */ //there may be other constructors, fields, methods not shown /**Restaurant represents all the tables at a restaurant*/ public class Restaurant { public ArrayList<SingleTable> tableList; //there may be other constructors, fields, methods not shown /** Calculates and returns the average view quality of all of the * tables in the tableList field */ public double getAverageView() { /** implementation not shown */ }
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning