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
umka21 [38]
3 years ago
13

Write a program to create an interface Shape containing the method declarations of area and perimeter. Then, create a class Rect

angle to implement the two methods.
Computers and Technology
1 answer:
irakobra [83]3 years ago
6 0

Answer:

Explanation:

An interface is similar to a class, to create an interface we use interface keyword, in an interface there can be abstract methods and constants only,we can not instantiate an interface.All the variables declared inside an interface are public,static and final  by default.

While using interface child class must use implements keyword

We can define an  interface by using below syntax-

<interface> <interface-name>{

}

For example lets create Shpae interface

interface Shape{

public int area(int length, int width);

public int perimeter(int length, int width);

}

Now lets create Rectangle class-

class Rectangle implements Shape{

public int area(int length, int width){

int area = 0;

area = length * width;

return area;

}

public int perimeter(int length, int width);

int perimeter = 0;

perimeter = 2*(length+width);

return perimeter ;

}

You might be interested in
MORE FREEE POINTS AYEEE
Lerok [7]

Answer:

Hehehehehe

Explanation:

6 0
3 years ago
Read 2 more answers
PLEASE HELP QUICK ASAP NO LINKS PYTHON CODING
Mademuasel [1]

Answer:

its for the movement

Explanation:

6 0
3 years ago
Read 2 more answers
GIVING BRAINLIEST What does output allow a computer to do? Display information Receive information Do complex math problems Do m
kumpel [21]
The answer is display information
4 0
3 years ago
Read 2 more answers
The movie polar express was critically acclaimed due to the unbelievably lifelike movements of Tom Hanks character
Fed [463]
I think it is greyhound
6 0
3 years ago
Which graph or chart shows changes in the value of data?
yKpoI14uk [10]

Answer:

Bar graph and Pie chart

3 0
3 years ago
Read 2 more answers
Other questions:
  • 125 • 12² what is the answer?<br>- 124​
    6·1 answer
  • E-mail is an temporary message medium.<br> a. True<br> b. False
    5·2 answers
  • Is ubisoft still making assassins creeds on xbox 360
    8·2 answers
  • Describe a new career in computer science that may be created in the future. Include supporting evidence in your response that s
    13·1 answer
  • What is ‘Software Testing’?
    13·1 answer
  • Which of the following is NOT an e-reader you would use as an alternative to carrying around a set of textbooks?
    13·1 answer
  • Explain how to utilize the computer in rooms management.​
    13·1 answer
  • One security component that doubles as a network component
    5·2 answers
  • What are the two different types of dns requests?
    5·2 answers
  • Your primary responsibility as a systems analyst concerns:_____.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!