Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define a class with the following specification: The class name is Study Desk with three private instance variables: toplength (of the type double) and topWidth
Define a class with the following specification: The class name is Study Desk with three private instance variables: toplength (of the type double) and topWidth (of the type double), and hasDrawers (with type boolean) with default values of 110 centimeters for its top length and 70 cm width and false (which means that the table doesn't have drawers), respectively. Write two constructors for this class. A default constructor that takes no arguments and which initializes all the data members to the default values specified in step a. The second constructor takes three arguments for length, width and hasDrawers of the StudyDesk. Provide mutator (set) methods for length and width data members. d. Define a method called calcTopArea() that returns the area of the desk surface area. Define a method called equals that returns true if the two tables have the same desktop area and then both have the same boolean value for hasDrawers data member. Define a method called displayDeskDetails() to display on the screen desk details as in the following sample: f. Desktop length: Desktop width: Has Drawers: 110 70 false
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started