subject

Public class Membership {
private String id;
public Membership(String input)
{ id = input; }
// Rest of definition not shown
}
public class FamilyMembership extends Membership
{
private int numberInFamily = 2;
public FamilyMembership(String input)
{ super(input); }
public FamilyMembership(String input, int n)
{
super(input);
numberInFamily = n;
}
// Rest of definition not shown
}
public class IndividualMembership extends Membership
{
public IndividualMembership(String input)
{ super(input); }
// Rest of definition not shown
}
The following code segment occurs in a class other than Membership, FamilyMembership, or IndividualMembership.
FamilyMembership m1 = new Membership("123"); // Line 1
Membership m2 = new IndividualMembership("456"); // Line 2
Membership m3 = new FamilyMembership("789"); // Line 3
FamilyMembership m4 = new FamilyMembership("987", 3); // Line 4
Membership m5 = new Membership("374"); // Line 5
Which of the following best explains why the code segment does not compile?
A) In line 1, m1 cannot be declared as type FamilyMembership and instantiated as a Membership object.
B) In line 2, m2 cannot be declared as type Membership and instantiated as an IndividualMembership object.
C) In line 3, m3 cannot be declared as type Membership and instantiated as a FamilyMembership object.
D) In line 4, m4 cannot be declared as type FamilyMembership and instantiated as a FamilyMembership object.
E) In line 5, m5 cannot be declared as type Membership and instantiated as a Membership object.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
What allows you to create a wireless connection among your smart devices
Answers: 2
question
Computers and Technology, 23.06.2019 04:20
4. a1. vince owns a television repair shop that is insured undera commercial package policy. the policy includes thebuilding and personal property coverage form and thecauses-of-loss broad form. the declarations page indicatesthat coverage applies to both the building and the namedinsured's business property. explain whether or not thefollowing losses would be covered under his policy.a. a fire occurs on the premises, and the building isbadly damaged.b. a burglar steals some money and securities from anunlocked safe.c. a business computer is damaged by vandals whobreak into the shop after business hours.d. a tornado touches down near the store. several tel-evision sets of customers in the shop for repair aredamaged in the storm.til
Answers: 2
question
Computers and Technology, 24.06.2019 08:50
Write a program that will compute the volume of ice cream served in a cone. as you can see in the diagram below, the ice cream is served as a hemisphere of frozen deliciousness on top of a cone, which is also packed with frozen deliciousness. thus, the total volume of ice cream sold is the volume of the hemisphere plus the volume of the cone. the example shows an ice cream cone in which the hemisphere and cone have a radius of 10 inches and the cone has a height of 15 inches. your program must instead prompt for these two values, which are taken from the keyboard as integers: • the hemisphere/cone radius in inches, and
Answers: 3
question
Computers and Technology, 24.06.2019 17:40
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
You know the right answer?
Public class Membership {
private String id;
public Membership(String input)
{ id...
Questions
question
Mathematics, 06.05.2020 20:11
question
History, 06.05.2020 20:11