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
In a C++ program, two slash marks ( // ) indicate:
Ganezh [65]

Answer:

The option(B) is the correct answer .

Explanation:

In C++  the // (two slash marks ) indicating the beginning of a comment .The two slash marks ( // ) comment the single line in a program.To use two slash marks ( // ) comment we simply write  // in which line we have to make comment.

following are the example of code in c++

#include<iostream.h> // header file

void main() // main method

{

cout<< " india"; // print india

}

here // indicating the beginning of a comment .

5 0
3 years ago
What type of activities are performed with the help of the software used in hospitals?
faust18 [17]

Answer:

Xrays, Ultrasounds, managing patient records, communicating with colleagues, etc.

7 0
3 years ago
Read 2 more answers
Whereas enterprise network convergence focuses on the consolidation of traditionally distinct voice, video, and data communicati
Vinil7 [7]

Answer: Unified communication

Explanation: Unified communication is the communication technique in which merges various communication routines into a individual business.It works as the phone system which helps in increment of productivity in an organizational business.

The unifying of voice,data/information,video etc is done for optimizing and improving the business that also results in  faster communication rates, secure communication etc.

4 0
3 years ago
How many degrees of freedom does any unconstrained object have in 3-D modeling?
Free_Kalibri [48]
I think its 6 degrees

3 0
3 years ago
I will give brainliest to the first person who can answer correctly.
Mariulka [41]
I think that the answer wiloukd be B. For #31 and for #32 A.
4 0
3 years ago
Other questions:
  • A network administrator has been given a network of 172.16.85.0/21 and wants to know the usable range of IP addresses on that su
    13·1 answer
  • Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their
    14·1 answer
  • Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output param
    11·1 answer
  • You are looking for a backup that copies only the files that have changes since the last full backup. Which of the following wil
    13·1 answer
  • What are the correct answers?
    11·1 answer
  • When you pass an argument to a method, the argument's data type must be ____________ with the receiving parameter's data type?
    11·1 answer
  • Aubrey uses the following formula to calculate a required value. Which elements of the formula use mixed cell referencing?
    13·2 answers
  • I was killed <br><br> යඞ <br><br> what do i do
    10·1 answer
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    7·2 answers
  • What is a primary risk to the Workstation Domain, the Local Area Network (LAN) Domain, and the System/Application Domain
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!