Question: AS Given the following code: public class Animate private String type: public Animal (String type) this.type = type: ) ard public class Dog extends Animal

 AS Given the following code: public class Animate private String type:
public Animal (String type) this.type = type: ) ard public class Dog
extends Animal private String color: /* Constructor Goes Here / ) Which
of the following could be the constructor for the Dog class? 1.
public Dog(String coton super.type = "Dog": this.color color: > II. public Dog(String
color) { super("Dog"); this.color = color: 3 III. public Dog(String type, String

AS Given the following code: public class Animate private String type: public Animal (String type) this.type = type: ) ard public class Dog extends Animal private String color: /* Constructor Goes Here / ) Which of the following could be the constructor for the Dog class? 1. public Dog(String coton super.type = "Dog": this.color color: > II. public Dog(String color) { super("Dog"); this.color = color: 3 III. public Dog(String type, String color) super(type); this.color = color; } Given the following code: public class Car private String make: publie Car (String make) this.nake make 1 public Card) make = "Unspecified"; } public class Tesla extends Car private String color: public Tesla (String color) { this.color = color; 3 Which of the following best describes the execution of the code? This code will create a superclass object, but the make variable will be null. This code will create a superclass object with the make variable set to Tesla from the Subclass class name. This code will not execute since a call to the Superclass constructor is not made. This code will create a superclass object by calling the no-argument Car constructor. canvas instructure.com Question 17 1 pts Given the following code: public int addNumbers(int one, int two) Which method will correctly override this method when placed in a subclass? 1. public int addNumbers(int one, int two, int three) II. public int addNumbers(int one, int two) III. public int addNumbers(int a, int b) IV. public int addNumbers) O I and IV only O II and III only Ill only Oll only Question 18 1 pts Given the following code: public class Calculator /* Constructor and methods omitted. public double multiply(double numi, double num2) return numinum2: } public class ScientificCalculator extend s Calculator /* Constructor and methods omitted public double square (double number) { /* Missing Code */ } 3 What goes in the missing code if the desired return is a square of the number? return super.multiply(num1, num2); return super.multiply(number); return super.multiply(number, number): return super.multiply(num1): Given the following code: public class Tree private boolean evergreen 1. Constructor and methods omitted / public String toString() String line - "This tree is 1 af levergreen) Line + "not": return Line - "an evergreen" 3 > public class Fruit Tree extends Tree private String fruit; /* Constructor and methods omitted public String toString() { /* Missing Code +/ > > What goes in the missing code if the desired return is the following (as an example): This Tree is not an evergreen fruit tree 1. return super: return fruit tree", 2 return super() + " fruit tree"; 3. System.out.println(super); return fruit tree"; 4. return super.toString() + " fruit te ee"; Given the following code: public class Tree private boolean evergreen public Treehoolean evergreen) this.vergreen overgreen > 1 public class Fruittree extends Tree private String fruit public Fruit Tree (String fruit, bool ean evergreen) * Missing Code What is the correct implementation for the subclass constructor? 1. super levergreen); this.fruit = fruit; 2. evergreen evergreen; fruit fruit; 3. this. fruit = fruit; super(evergreen); 4. super.evergreen = evergreen; this. fruit = fruit; 1 N 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!