answer.
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
snow_lady [41]
2 years ago
10

A class car and its subclass bmw each have a method run(), which was written by the developer as part of the class definition. i

f carobj refers to an object of type bmw, what will carobj.run(); do? the run() method defined in bmw will be called. the compiler will complain that run() has been defined twice. the run() method defined in car will be called.
Computers and Technology
1 answer:
krok68 [10]2 years ago
5 0

The answer is : the run() method defined in BMW will be called.

run() BMW

You might be interested in
Which phrase best describes a scenario in Excel 2016?
Airida [17]

Answer:

what are the phrases?

Explanation:

6 0
2 years ago
________ is the process of converting a poorly-structured table into two or more well-structured tables. optimization normalizat
bulgar [2K]

Answer:

Normalization

Explanation:

Converting a poorly-structured table and optimizing its database structure in order to reduce redundancy in relations can be referred to as database normalization. If the data is not redundant means that data inconsistencies and errors like deletion and insertion will get reduced or eliminated significantly.

4 0
2 years ago
CodeHS Python Rainforest Exercise 5.4.7: Categories
nalin [4]

Answer:

List=[['Computers','IT','Programming'],['Maths', 'Algebra', 'Geometry']]

i=0

k=0

for i in range(0,2):

   print("Category:"+List[i][0])

   for k in range(1,3):

       print("\t"+List[i][k])

   

Explanation:

The required program is as above. We have used here a multidimensional list. The 0 of each row has the category,and rest are sub categories. The program above has limitations but is good enough to explain the fundamentals required.

7 0
2 years ago
Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
Alex787 [66]

Answer:

One of the strategies to avoid nested conditional is to use logical expressions such as the use of AND & operator.

One strategy is to use an  interface class with a method. That method can be created to be used for a common functionality or purpose. This is also called strategy design pattern. You can move the chunk of conditional statement to that method. Then each class can implement that interface class and use that shared method according to their own required task by creating objects of sub classes and call that common method for any such object. This is called polymorphism.

Explanation:

Nested conditionals refers to the use of if or else if statement inside another if or else if statement or you can simply say a condition inside another condition. For example:

if( condition1) {  

//executes when condition1 evaluates to true

  if(condition2) {

//executes when condition1  and condition2 evaluate to true

  }  else if(condition3) {

 //when condition1 is true and condition3 is true

} else {

 //condition1  is true but neither condition2 nor conditions3 are true

}  }

The deeply nested conditionals make the program difficult to understand or read if the nested conditionals are not indented properly. Also the debugging gets difficult when the program has a lot of nested conditionals.

So in order to avoid nested conditionals some strategies are used such as using a switch statement.

Here i will give an example of the strategies i have mentioned in the answer.

Using Logical Expressions:

A strategy to avoid nested conditionals is to use logical expressions with logical operators such as AND operator. The above described example of nested conditionals can be written as:

if(condition1 && condition2){  //this executes only when both condition1 and condition2 are true

} else if(condition1 && condition3) {

this executes only when both condition1 and condition3 are true

} else if(condition1 ){

//condition1  is true but neither condtion2 nor condtion3 are true  }

This can further be modified to one conditional as:

if(!condition3){

// when  condition1 and condition2 are true

}

else

// condition3 is true

Now lets take a simple example of deciding to go to school or not based on some conditions.

if (temperature< 40)

{

   if (busArrived=="yes")

   {

       if (!sick)

       {

           if (homework=="done")

           {

               printf("Go to school.");

           }

       }                    

   }

}

This uses nested conditionals. This can be changed to a single conditional using AND logical operator.

if ((temperature <40) && (busArrived=="yes") &&

(!sick) && (homework=="done"))

{    cout<<"Eligible for promotion."; }

The second strategy is to use an interface. For example you can

abstract class Shape{

//declare a method common to all sub classes

  abstract public int area();

// same method that varies by formula of area for different shapes

}

class Triangle extends Shape{

  public int area() {

     // version of area code for Triangle

return (width * height / 2);

  }

}

class Rectangle extends Shape{

  public int area() {

     // version of area code for Rectangle

    return (width * height)

  }

}

// Now simply create Rectangle or Triangle objects and call area() for any such object and the relevant version will be executed.

4 0
2 years ago
An oil company is investigating whether they are likely to find oil at a certain site. They will use an expert system to help th
11Alexandr11 [23.1K]
The expert system are given inputs such as questions, locations and information. The expert system processes and advice the user on what to do. If the user inputs the location of an oil site and ask a question if they are able to drill an oil out of the site, then the expert system calculates and gives you the answer you need. Though the expert system makes errors just like humans.
6 0
2 years ago
Other questions:
  • You buy a $3,500 car and finance it through the car dealer. the contract says if you are two months delinquent with your payment
    9·1 answer
  • RFID tags are used in secure environments primarily due to the fact they are impossible to counterfeit.
    5·1 answer
  • A slide in Blake's presentation contained the following information:
    11·1 answer
  • #Remember that Fibonacci's sequence is a sequence of numbers
    14·1 answer
  • Write a Python function called simulate_observations. It should take no arguments, and it should return an array of 7 numbers. E
    7·1 answer
  • In this exercise, you will create a couple of helper methods for ArrayLists in a class called ArrayListMethods.
    10·1 answer
  • Ld' is the instruction with the longest latency on the CPU from Section 4.4 (in RISC-V text). If we modified ld and sd so that t
    15·1 answer
  • As part of the duties of a digital forensics examiner, creating an investigation plan is a standard practice. Write a 3 to 4 (no
    9·1 answer
  • Select the correct navigational path to freeze the top row of your worksheet. Select the panes you wish to freeze. Click the tab
    15·2 answers
  • Which business case is better solved by Artificial Intelligence (AI) than conventional programming
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!