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
Allushta [10]
3 years ago
5

How would you declare an interface named Sports that has the following (show them in your answer as well): A method called jump

that has no parameters and does not return anything. A method called throw that has one parameter called distance and is an integer and does not return anything. 2) [5 pts] Assuming the interface exist from 1) above. Give me the class header for a class named Football that would use this interface. 3) [5 pts] Assuming a parent class called GrandParents exist. How would you create a child class called GrandChild that would be a direct child of the class GrandParents
Computers and Technology
1 answer:
Artyom0805 [142]3 years ago
6 0

Answer:

See explanation

Explanation:

An interface is declared as follows:

interface interface_name{          

   member fields

   methods  }  

So the Sports interface is declared as:

interface Sports{   }  

You can also write its as:

public interface Sports { }

Now this interface has a method jump that has no parameters and does not return anything. So it is defined as:

void jump();

You can also write it as:

public void jump();

Notice that it has a void keyword which means it does not return anything and empty round brackets show that it has no parameters. Lets add this to the Sports interface:

interface Sports{  

void jump();   }    

You can write it as:

public interface Sports {

  public void void jump();  }

Next, this Sports interface has a method throw that has one parameter called distance and is an integer and does not return anything. So it is defined as:

throw(int distance);

You can also write it as:

  public void throw(int distance)

Notice that this function has a void return type and one int type parameter distance. Now lets add this to Sports interface:

interface Sports{        

   void jump();  

   void throw(int distance);   }

This can also be written as:

public interface Sports {

 public  void jump();  

   public void throw(int distance); }

Next, the class header for a class named Football that would use this interface is as follows:

class Football implements Sports{  }

You can use the methods of Sports in Football too. So the complete interface with class Football becomes:

interface Sports{  

void jump();  

void throw(int distance);

}  

class Football implements Sports{  

public void print(){

}  

public void throw(int distance) {

}

Next we have a parent class called GrandParents. So child class called GrandChild that would be a direct child of the class GrandParents is:

class GrandChild extends GrandParents {   }

Basic syntax of a parent class and its child class is:

class child_class_name extends parent_class_name

{  

  //member fields and methods

}

You might be interested in
An online game is played with two dice, explain why decomposition will be used in creating the algorithm for the game?
wolverine [178]
Decomposition will be used so you can break down the game into smaller and more manageable parts.
5 0
3 years ago
Read 2 more answers
What is the different between 32bit anf 64 bit verision​
Elina [12.6K]

<u>The different between 32 bit and 64 bit version:​</u>

  • The main difference between 32-bit and 64-bit versions is that a 32-bit version can access 2^3^2 memory addresses which is roughly equivalent to 4 GB of memory.
  • On the other hand, a 64-bit version can access 2^6^4 memory addresses which equates to a huge amount of memory, 16 exabytes to be precise.  
  • Nowadays, we observe that almost all the computers have 64-bit processors, which means that they can access any amount of memory over 4 GB till 16 exabytes.
  • 64-bit processors have various advantages like the increased speed of operations, smooth multitasking and they can also support video games and software's that have high graphical requirements.
8 0
3 years ago
Nicole is in a study group to prepare for a test on plant biology, a subject she knows a lot about. During their meetings, she a
Anestetic [448]

Answer:

b

Explanation:

i pretty sure it b , yep it is b

4 0
3 years ago
Read 2 more answers
The full meaning of ENIAC,ABACUS,EDVAC,EDSAC<br>and explain ​
balandron [24]

Answer:

ENIAC: Electronic Numerical Integrator and Computer.

ABACUS: Abundant Beads, Addition and Calculation Utility System.

EDVAC: Electronic Discrete Variable Automatic Computer

EDSAC: Electronic Delay Storage Automatic Computer

7 0
3 years ago
What is the answer ??​
Natali5045456 [20]

<em>=</em><em> </em><em>Option</em><em> </em><em>b</em><em> </em><em>Minicomputer ..........</em>

3 0
2 years ago
Read 2 more answers
Other questions:
  • Background Susan finished work on system architecture issues, and her system design specification was approved. Now she is ready
    15·1 answer
  • Determine encryption that is needed to provide security for the company’s system. This will include plans to address: Passive an
    11·1 answer
  • To change to the completed application’s directory, we opened a command window and used the ________ command to change to the di
    7·1 answer
  • What is AI and its necessary types?
    6·1 answer
  • ​according to your text, digital natives tend to prefer different digital communication channels more than do digital immigrants
    5·1 answer
  • This type of peripheral is used to interact with, or send data to, the computer.
    12·2 answers
  • When might be the best time to start saving for retirement?
    11·2 answers
  • What are the different types of document required for mail merge?
    5·1 answer
  • If you want to share information with individuals who are internal to your organization, which type of network would you want to
    6·1 answer
  • Which emerging technologies will have more injury on our day to day country &amp; How?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!