Question

In: Computer Science

To make class DressShirt inherit the functionality of both Clothing and Shirt (from previous question), the...

To make class DressShirt inherit the functionality of both Clothing and Shirt (from previous question), the class header would be:

Group of answer choices

public class DressShirt inherits Shirt, Clothing

public class DressShirt inherits Shirt

public class DressShirt extends Shirt

public class DressShirt extends Shirt, Clothing

If Shirt inherits Clothing, then Shirt has direct access to the ______ members of Clothing

Group of answer choices

public and protected

public

private

protected

private and protected

Shirt inherits Clothing. What is the first thing that must happen in the Shirt constructor?

Group of answer choices

Initialize the required Shirt fields

Call the Clothing constructor

Create all objects required for Shirt fields

Map the parameters coming into the constructor to Shirt fields

Solutions

Expert Solution

Question:
To make class DressShirt inherit the functionality of both Clothing and Shirt (from the previous question), the class header would be:
Ans: public class DressShirt extends Shirt, Clothing

Whenever we need to inherit the functionality of the classes, we need to use the keyword "extends"
Since we need to inherit the functionality of the two classes Shirt and Clothing.
We need to use the extend keyword followed by the class names that we need to implement as:
public class DressShirt extends Shirt, Clothing

Question:
If Shirt inherits Clothing, then Shirt has direct access to the ______ members of Clothing
Ans: public and protected

As a class inherits other classes, then the inherited class which is subclass has direct access to the public and protected members of the class Clothing which is the superclass.

Question:
Shirt inherits Clothing. What is the first thing that must happen in the Shirt constructor?
Ans: Call the Clothing constructor

The first thing that happens in the shirt class after inheriting the Clothing class is it will call the clothing constructor.

(Feel free to drop me a comment, If you need any help)


Hope this Helps!!!
Please upvote as well, If you got the answer?
If not please comment, I will Help you with that...


Related Solutions

1. when you create a class by making it inherit from another class, the new class...
1. when you create a class by making it inherit from another class, the new class automatically, contains the data fields and _____ of the original class a. fonts b. methods c. class names d. arrays 2. if a programming language does not support ________, the language is not considered object oriented a. syntax b. applets c. loops d. polymorphism 3. when you create a class and do not provide a ______, java automatically supplies you with a default one...
Write a class that extends the LeggedMammal class from the previous laboratory exercise.
C++ code on Visual Studio Code:Write a class that extends the LeggedMammal class from the previous laboratory exercise. The class will represent a Dog. Consider the breed, size and is registered. Initialize all properties of the parent class in the new constructor. This time, promote the use of accessors and mutators for the new properties. Instantiate a Dog object in the main function and be able to set the values of the properties of the Dog object using the mutators....
Implement a superclass Person. Make two classes, Student and Instructor, that inherit from Person. A person...
Implement a superclass Person. Make two classes, Student and Instructor, that inherit from Person. A person has a name and a year of birth. A student has a major, and an instructor has a salary. Write the class declarations, the constructors, and the methods toString for all classes. Supply a test program that tests these classes and methods. Add a method Public static Measurable max(Measurable[ ] objects) to the Data class that returns the object with the largest measure. Implement...
Locate your Student project from the previous in-class assignment. You will add a new class to...
Locate your Student project from the previous in-class assignment. You will add a new class to that project. 1. Create a class called Course. It should have a field to hold an ArrayList of Student objects. 2. Create a constructor for Course that accepts an ArrayList of Student objects, and set field to the parameter. 3. In the Course class, create a method called addStudent(Student s). This should add the parameter "s" to the ArrayList of Student objects. 4. In...
Q: IN C++ -  Redesign the CaesarCipher class as a subclass of the SubstitutionCipher from the previous...
Q: IN C++ -  Redesign the CaesarCipher class as a subclass of the SubstitutionCipher from the previous problem my code is: #include <iostream> #include <string> using namespace std; class SubstitutionCipher { public: //Define your key which is a permutation of 26 alphabets string key; //Constructor to create an instance which initializes the key with the given permutation SubstitutionCipher(string k) { key = k; } //function to encode a string string encode(string data) { //initialize encoded data string encodedData = data; //replace...
In Java in previous question #1, you created a method called isDNAvalid() in the DNA class....
In Java in previous question #1, you created a method called isDNAvalid() in the DNA class. You probably looped through the entire sequence one character at a time (using charAt() method of the String class), and check if the character is 'A', 'T', 'G', or 'C'. If it is not one of these four characters, the sequence contains an invalid base. Please re-create the isDNAvalid() method using a character pattern and the regular expression to validate the DNA sequence. previous...
Question: Class Diagram – Make a class diagram for 'Patient Appointment' showing attributes and operations /...
Question: Class Diagram – Make a class diagram for 'Patient Appointment' showing attributes and operations / methods. Associations are optional. References from earlier questions/instructions from the project: 1) Use Case Tables – Consider the Mentcare system for which we considered requirements in the previous module. Make 2 use case tables for this system (table examples may be found in the textbook, section 5.2, and in the content guides). Be sure to consider who the actors would be in each case...
Question: SPRINT , Inc., manufactures athletic shoes and athletic clothing for both amateur and professional athletes....
Question: SPRINT , Inc., manufactures athletic shoes and athletic clothing for both amateur and professional athletes. The company has two product lines (clothing and shoes), which are produced in separate manufacturing facilities; however, both manufacturing facilities share the same support services for information technology and human resources. The following shows total costs for each manufacturing facility and for each support department. Total Costs by Department (in thousands) Information technology (IT) $ 2,000 Human resources (HR) 1,000 Clothing $10,000 Shoes $8,000...
Using both the arguments from the previous lecture about floating exchange rates and the theory of...
Using both the arguments from the previous lecture about floating exchange rates and the theory of optimal currency unions, make the arguments both for and against the idea of having a single Australia & New Zealand currency.
Create 2 derived classes from Clothing class: Pants class Write only necessary constructors Override the wash()...
Create 2 derived classes from Clothing class: Pants class Write only necessary constructors Override the wash() method to indicate that pants are dry clean only. Include additional method hang() Add to your driver/tester file to make and print new pants objects and test it. Shirt class Include additional property of type string called sleeves. Write necessary constructors For sleeves only allow it to be set to {"short", "long", "none"} For size, only allow {"S","M","L"} Override the wash() method to indicate...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT