1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jonny [76]
3 years ago
13

Consider the following class definitions.public class Bike{private int numWheels = 2;// No constructor defined}public class EBik

e extends Bike{private int numBatteries;public EBike(int batteries){numBatteries = batteries;}}The following code segment appears in a method in a class other than Bike or EBike.EBike eB = new EBike(4);Which of the following best describes the effect of executing the code segment?А. An implicit call to the zero-parameter Bike constructor initializes the instance variable numwheels. The instance variable numBatteries is initialized using the value of the parameter batteries.
B. An implicit call to the one-parameter Bike constructor with the parameter passed to the EBike constructor initializes the instance variable numwheels. The instance variable numBatteries is initialized using the value of the parameter batteries. C. Because super is not explicitly called from the EBike constructor, the instance variable numWheels is not initialized. The instance variable numBatteries is initialized using the value of the parameter batteries.
D. The code segment will not execute because the Bike class is a superclass and must have a constructor. E The code segment will not execute because the constructor of the EBike class is missing a second parameter to use to initialize the numWheels instance variable.
Computers and Technology
1 answer:
nadya68 [22]3 years ago
4 0

Answer:

The answer is "Option A".

Explanation:

Please find the complete program in the attached file.

The given program includes a super-class Bike having a private integer numWheels parameter. The class EBike inherits the class Bike, EBike comprises one parameter function Object() which utilizes its variable number of the private integer Battery level of the battery parameter and the wrong choice can be defined as follows:

In choice B, it is wrong since there is no constructor with a single argument in the Bike class.

In choice C, it is wrong since there no need to call the base class constructor with the super keyword.

In choice, D is wrong because there no need to create a constructor of the base class.

In choice, E is wrong because it does not require the second EBike constructor parameter.

You might be interested in
Write a Python 3 program to read from a .csv file containing rates from power companies. Your program should determine the avera
aliya0001 [1]

Answer:

In python:

file = open("rates.csv", "r")

ratecount = 0

ratesum = 0

mylist = []

rates = file.readlines()

for nums in rates:

     num = nums.rstrip('\n')

     mylist.append(int(num))

     for i in num:

           ratesum= ratesum + int(i)

           ratecount = ratecount + 1

print("Maximum Rate: "+str(max(mylist)))

print("Minimum Rate: "+str(min(mylist)))

print("Average Rate: "+str(ratesum/ratecount))

Explanation:

This opens the csv file

file = open("rates.csv", "r")

This initializes the number of rates in the file

ratecount = 0

This initializes the sum of the rates

ratesum = 0

This initializes an empty list

mylist = []

This reads the rates into lines

rates = file.readlines()

This iterates through the rates (as a string)

for nums in rates:

This removes the newline character \n in the rates

     num = nums.rstrip('\n')

This appends the rates (as an integer) to the empty list

     mylist.append(int(num))

The following counts the rates in the file and also sum them up

<em>      for i in num: </em>

<em>            ratesum= ratesum + int(i) </em>

<em>            ratecount = ratecount + 1 </em>

This prints the maximum of the rates

print("Maximum Rate: "+str(max(mylist)))

This prints the minimum of the rates

print("Minimum Rate: "+str(min(mylist)))

This calculates and prints the average rate

print("Average Rate: "+str(ratesum/ratecount))

6 0
3 years ago
How are static variables and methods created in Java? What happens if a non-static method of a class tries to access a static va
9966 [12]

Answer:

Static variables are the variables decaraed with keyword static, static variables must be deacraled inside the class body, means we can not declare a static variable inside a method or consttructor, static variable belongs to class, for a class only one copy is created for static variable and used by all the objects/instances.

Static variable can access with class name like

X.i

Static method are the methods defined with static keyword, static method are also part of a class, we can access static meethod using class name like

X.printI()  

Explanation:

class X

{

//to create a static variable we need use static keyword with variable name like

public static int i;

// to create a static method we need to use static keyword while defining a method like

public static void printHello() {

 System.out.println("Hello");

}

/*

 * A non static method can access static variable of a class there is no issue

 * with that we can use a static variable in a non static method like

 */

public void printI() {

 System.out.println(i);

}

/*

 * As long as the class exist in JVM static variables will be there, as static

 * variable belong to class not with the instance,

 * it does not matters if there are instance exist or not

 */

}

4 0
3 years ago
3. C R M systems: – Capture and integrate customer data from all over the organization – Consolidate and analyze customer data –
inysia [295]

Answer:CRM stands for Customer Relationship Management. It is a system for managing customers and their needs.

Collaborative CRM

Explanation:

The system described here involves communication between different departments and exchange of customers data and information. This is typical of collaborative CRM software

7 0
3 years ago
You want to send an email message to your friend to describe your meeting with Michal. However, you incorrectly type the name as
Gemiola [76]

Answer:

Option B.

Explanation:

The delete key is used to delete the symbol after the insertion point.

Here, Michal is typed as Michael.

So, to delete the letter e from Michael, put the insertion point before e.

If you put insertion point after the letter e or before the letter l, l gets deleted.

In no case, you can put the insertion point after the letter l.

So, option B is correct.

4 0
3 years ago
Who can pick up GPS signals
bazaltina [42]

Devices such as TomTom GPS and Garmin GPS pick up a GPS signal


I hope that's help !

5 0
3 years ago
Other questions:
  • Which of these definitions BEST explains what plagiarism is:
    14·2 answers
  • The Internet Engineering Task Force (IETF) defines the protocols and standards for how the Internet works. The members of the IE
    12·1 answer
  • What are some options available in the Spelling and Grammar Checker? Check all that apply. Change and Change All Redo and Repeat
    15·2 answers
  • A letter of application should be written on:
    13·1 answer
  • Hey im b---o---r---e---d dont report cuz if u do ur l a m e :)
    14·1 answer
  • PLZ HELP WILL MARK BRANLIEST Jargon is:
    9·1 answer
  • The 0-1 knapsack problem is the following. A thief robbing a store finds n items. The ith item is worth vi dollars and weighs wi
    14·1 answer
  • Describe your ideas for a keyboarding game that would help someone improve their skills.
    6·1 answer
  • A file ____ shows the location of a file or folder
    12·1 answer
  • What is the output for the following program?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!