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
5. In Access, data is stored in a _______ once a form is completed. A. cell B. page C. record D. form
guajiro [1.7K]
Cell dosent make sense at all, page also is completely nonsense, fourm also has nothing to do with stored data. Your awnser is C. Record 
3 0
3 years ago
Explain the role of ICT in banks​
vladimir1956 [14]

Answer: ICT help banks improve the efficiency and effectiveness of services offered to customers, and enhances business processes, managerial decision making, and workgroup collaborations, which strengthens their competitive positions in rapidly changing and emerging economies.

Explanation: please give branliest I only need one more to make ace

7 0
3 years ago
Describe orderly how to save a Word document into a folder​
ivann1987 [24]
In order to do that you go onto the document you are going to save, on the top left it has the word “file”, click on that, once clicked it should say “Save as” and click on that, it will then ask you where you want it or which folder and you click the folder you want and finally click “save”
7 0
3 years ago
When you power down a computer and turn off the rear computer case, the ______ is still on?
ladessa [460]
The battery is still on.
5 0
4 years ago
Read 2 more answers
Which key on the keyboard do you use when you copy using Drag and Drop? The Alt key. The Ctrl key. The Shift key. None of the ab
tamaranim1 [39]
CTRL key is used indeed
6 0
3 years ago
Read 2 more answers
Other questions:
  • What does the security element of non-repudiation mean in e-commerce cybersecurity? A. Data needs to be available at all times.
    10·1 answer
  • Your Economics teacher has asked you to create a chart showing how supply and demand affects the price of gasoline. Which applic
    11·1 answer
  • What are the four types of technical drawing?​
    9·1 answer
  • In what software development model does activity progress in a lock-step sequential process where no phase begins until the prev
    7·1 answer
  • max is a function that expects two integer parameters and returns the value of the larger one. Two variables, population1 and po
    15·1 answer
  • Identify a true statement to determine the number of columns in a web table.
    7·1 answer
  • I have at least 20-30 typing entries on my keyboarding log <br><br><br> true or false
    8·1 answer
  • Most portable devices, and some computer monitors have a special steel bracket security slot built into the case, which can be u
    13·1 answer
  • I have this project and I can't do anything about it, I do really need help ASAP
    5·1 answer
  • PLEASE HURRY!!!<br> Look at the image below
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!