QUESTION 4 Assume that class Furniture has following two private data fields: private String name; private int code; and

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

QUESTION 4 Assume that class Furniture has following two private data fields: private String name; private int code; and

Post by answerhappygod »

Question 4 Assume That Class Furniture Has Following Two Private Data Fields Private String Name Private Int Code And 1
Question 4 Assume That Class Furniture Has Following Two Private Data Fields Private String Name Private Int Code And 1 (56.55 KiB) Viewed 16 times
QUESTION 4 Assume that class Furniture has following two private data fields: private String name; private int code; and the following method, in addition to other methods: public String toString() { return name + code; } Now, we want to write a class called Dining Set that inherits the properties of class Furniture as follows, having only one data field: public class DiningSet extends Furniture { private int sittingCapacity; We want to include a method toString in class Dining Set to create a String representation of the object, including all attributes. It can be written as follows: a. public String toString() { return this.toString() + sittingCapacity; } b. public String toString() { return super.toString() + sittingCapacity; } OC. public String toString() { return Furniture.toString() + sittingCapacity; } O d. public String toString() { return name + code + sittingCapacity; }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply