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
svlad2 [7]
3 years ago
11

Create an interface called Runner. The interface has an abstract method called run() that displays a message describing the mean

ing of run to the class. Create classes called Machine, Athlete, and PoliticalCandidate that all implement Runner.
The run() should print the following in each class:
Machine - When a machine is running, it is operating.
Athlete - An athlete might run in a race, or in a game like soccer.
PoliticalCandidate - A political candidate runs for office.
----------------------------------------------------------------------------------------------------
public class Athlete implements Runner
{
public void run()
{
// write your code here
}
}
--------------------------------------------------------------------------------------
public class DemoRunners
{
public static void main(String[] args)
{
Machine runner1 = new Machine();
Athlete runner2 = new Athlete();
PoliticalCandidate runner3 = new PoliticalCandidate();
runner1.run();
runner2.run();
runner3.run();
}
}
------------------------------------------------------------------------------------------
public class Machine implements Runner
{
public void run()
{
// write your code here
}
}
----------------------------------------------------------------------------------------------------
public class PoliticalCandidate implements Runner
{
public void run()
{
// write your code here
}
}
----------------------------------------------------------------------------------------------------
public interface Runner
{
// write your code here
}
----------------------------------------------------------------------------------------------------

Computers and Technology
1 answer:
4vir4ik [10]3 years ago
5 0

Answer:

Please find the code and its output in the attached file.

Explanation:

In the above-given code, an interface "Runner" is defined, inside the interface, an abstract method run is declared.

In the next step, three class "Athlete, Machine, and PoliticalCandidate" s defined that implements the run method, and use the print message that holds a given value as a message.

In the next step, a class "DemoRunners" is defined, and inside the main method, the three-class object is declared, which calls the run method.

 

You might be interested in
Instructions:Select the correct answer.
Dafna1 [17]
It would be a audio file -B.
8 0
3 years ago
"Memory refers to: A.the brain processes involved in the encoding, storage, and retrieval of information. B.the mechanisms drivi
natali 33 [55]

Answer: A

Explain:

you can use memory on a computer to retrieve passed data if your referring to brains memory that is memory of passed events

memory:1 the faculity by which the mind stores and members information

2 something remembered from the past a recollection

8 0
3 years ago
Photographs that are too dark or too light can be difficult to fix with photo-editing software.
Nana76 [90]
The answer is true :)
6 0
2 years ago
Read 2 more answers
The if/else if statement is actually a form of the __________ if statement.
romanna [79]

Answer:

The answer to this question is "nested".

Explanation:

The answer to this question is nested because, In programming languages, there is a concept of nested if-else statement. In nested if-else statement placing if statement inside another IF Statement that is known as nested If in C Programming.

Example of nested if can be given as

#include <stdio.h>

int main()

{

  int a,b,c;

printf("Enter 3 number\n");

scanf("%d",&a);

scanf("%d",&b);

scanf("%d",&c);

   if(a>b)

   {

    if(a>c)

    {

        printf("A is greater: %d",a);

    }

   }

   else

   {

       if(b>c)

       {

           printf("B is greater: %d",b);

       }

       else

       {

           printf("C is greater: %d",c);  

       }

   }

   return 0;

}

output:

Enter 3 number  

4

7

9

c is greater: 9

8 0
3 years ago
What is the purpose of the Print Area feature?
Lilit [14]

Explanation:

printing how many copies of a document should print

6 0
2 years ago
Read 2 more answers
Other questions:
  • What is the term for the process of gathering information through images taken at a distance?
    13·1 answer
  • Word's Help feature is useful if you need to quickly learn how to print a document
    14·1 answer
  • Write a Python program to do the following:
    12·1 answer
  • ¿Es especial que mi cumpleaños sea el día de San Valentín?<br><br> si o no
    11·2 answers
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • The two major types of system software programs are utility programs and the ________. Select one: A. user interface B. supervis
    13·1 answer
  • What is gained by increasing the ritation speed of a disk or cd?​
    9·1 answer
  • Will mark Brainliest!! What is the best hard disk compacity? Why?
    7·1 answer
  • The Table Design and Layout tabs are available under the
    13·2 answers
  • Why is making a model, or prototype, important in the design process?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!