Furniture Constructor Method Difficult When designing the following classes, ass
ID: 3729934 • Letter: F
Question
Furniture Constructor Method Difficult When designing the following classes, assume that a Desk is a Furniture. To construct a Furniture object, you must provide the cost (in dollars/cents) and the weight (in nearest pounds). To construct a Desk object, you must also provide the cost and weight, as well as the description of the desk and its height, width, and depth. Consider the following class. public class Furniture private double cost; private int weight; // This is the only constructor method public Furniture(double c, int w) cost-c weight W; // other data and methods not shown What would be a valid definition of the constructor method in the Desk class?Explanation / Answer
// taking parameters and assigning the values through constructora
public Desk(double c, int w, int desc, int h, int wi, int d)
{
cost = c;
weight = w;
description = d;
height = h;
width = wi;
depth = d;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.