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
An antonym for the word “help” which may be found in a dictionary is a. Assist c. Hold b. Abandon d. None of these
Luba_88 [7]
I would have to say the answer is abondon
5 0
3 years ago
Read 2 more answers
What will happen if Sam goes to the View menu, clicks Toolbars, and then clicks Picture?
elena-s [515]
I think the correct answer from the choices listed above is option C. If Sam goes to the View menu, clicks Toolbars, and then clicks Picture, then the picture toolbar will appear. Hope this answers the question. Have a nice day. Feel free to ask more questions.
4 0
3 years ago
Read 2 more answers
A bit pattern is shown below.<br> 01001110<br> Convert the bit pattern into decimal
Vera_Pavlovna [14]

Answer:

78

Explanation:

I always convert to hexadecimal first:

0100 = 4

1110 = E

(the matching of groups of 4 bits to one hex char is a lookup you can memorize)

so we have 4E, which is 4*16+14 = 78

Of course you can also go the long route:

01001110 = 0·2⁷+1·2⁶+0·2⁵+0·2⁴+1·2³+1·2²+1·2¹+0·2⁰ = 78

5 0
3 years ago
Kiko loves to surf the internet and check on different websites. One day he received an email from unknown source. When he opens
Angelina_Jolie [31]

He experienced phishing

Phishing is a method of trying to gather personal information using deceptive e-mails and websites.

Here are some measures to avoid phishing. You can pick up the one you liked the most

  • Always check the spelling of the URLs in email links before you click or enter sensitive information
  • Watch out for URL redirects, where you're subtly sent to a different website with identical design
  • If you receive an email from a source you know but it seems suspicious, contact that source with a new email, rather than just hitting reply.
  • Don't post personal data, like your birthday, vacation plans, or your address or phone number, publicly on social media
5 0
3 years ago
Write 4 types of viruses , explain them briefly.
wariber [46]

I can help with two.

Web Scripting Virus, A sneaky virus that targets popular websites. What this virus does is overwrite code on a website and insert links that can install malicious software on your device. Web scripting viruses can steal your cookies and use the information to post on your behalf on the infected website.

FILE INFECTOR, targeting executable files (.exe), file infector viruses slow down programs and damage system files when a user runs them.

8 0
3 years ago
Other questions:
  • A variable used as a subscript should be initialized to ________.
    12·1 answer
  • What type of computer is likely to use so-dimms, have an internal power supply, and use a desktop processor socket?
    10·1 answer
  • Which wildcard character replaces a single character in the command-line interface?
    11·1 answer
  • You accidentally moved your task bar from the bottom of the screen to the left side. You would like to
    14·2 answers
  • A type of backlight technology most commonly used in modern laptop devices is called____________.
    9·1 answer
  • The ........ tag is used to create a link to another document​
    9·1 answer
  • Help with this pleaseeeeeee​
    7·1 answer
  • Which command will provide us with a list of the available internal commands (commands that are part of Command Prompt, such as
    7·1 answer
  • NFPA 780, Standard for the Installation of Lightning Protection Systems provides information on the installation of _____ for li
    6·1 answer
  • How long does a seller have to ship an item on offerup
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!