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
Harrizon [31]
3 years ago
10

Write a program named RectangleArea to calculate the area of a rectangle with a length of 15.8 and a width of 7.9. The program s

hould have two classes, one is the RectangleArea holding the Main(), and the other one is Rectangle. The Rectangle class has three members: a property of length, a property of width, and a method with a name of CalArea() to calculate the area. You can invoke the auto-provided constructor or write a self-defined constructor to initialize the rectangle. Calculate and display the area of the rectangle by first initialize an object named myRectangle and then calculate its area using the CalArea() method.
Computers and Technology
1 answer:
stiv31 [10]3 years ago
4 0

Answer:

public class RectangleArea {

   public static void main(String[] args) {

       Rectangle myRectangle = new Rectangle(15.8, 7.9);

       double calArea = myRectangle.calcArea(15.8, 7.9);

       System.out.println("The area is "+ calArea);

   }

}

class Rectangle{

   private double length;

   private double width;

   //Defined Constructor

   public Rectangle(double length, double width) {

       this.length = length;

       this.width = width;

   }

   public double calcArea(double len, double wi){

       return len* wi;

   }

}

Explanation:

  • This is solved with Java programming language
  • Start by creating both classes RectangleArea and and Rectangle
  • SInce both classes are in the same file, only one can be public
  • Class Rectangle contains the three members are decribed by the question
  • private double length, private double width and the method calcArea(). It also has a sefl-declared constructor.
  • In the class RectangleArea, an object of Rectangle is created and initialized.
  • The method calcArea is called using the created object and the value is printed.
You might be interested in
Which directory holds most of the system log files?
faust18 [17]
I think the answer to that is /var/log hope this helps
5 0
3 years ago
Attackers need a certain amount of information before launching their attack. One common place to find information is to go thro
VARVARA [1.3K]

Answer:

The answer is Letter D. Dumpster diving.

Explanation:

This process of going through a target's trash is known in the community as dumpster diving. This attack is a technique used to retrieve information that could be used to carry out an attack on a computer network.

It is important to inform that the dumpster diving it is not limited to searching through  the trash for obvious treasures like acess codes or passwords written down on sticky notes.

8 0
2 years ago
Small-business owner Marcos set up his Google Ads campaign by thinking of “obvious” keywords off of the top of his head. What's
LiRa [457]

Answer:See the suggestions on the Opportunities tab

Explanation: The improvement in the Google ad can be made by the taking a look at the Opportunities tab which will display the adequate opportunities.

The tab displays these opportunities on the basis of the campaign settings, account's history, performance, style, trends etc and thus will create the appropriate opportunities accordingly.Thus Marcos will have to see the suggestion displayed on Opportunities tab

5 0
3 years ago
What is the average time a caller waits for an operator to answer?
kaheart [24]
3-4 minutes is about right is say
7 0
3 years ago
In the story, what are the song pauses a metaphor for?
-BARSIC- [3]

Answer:

D. The need to slow down more often in life.

4 0
3 years ago
Other questions:
  • How can i take out a random (double) number in between 5.0 to 15.0 in c++?
    7·1 answer
  • When RadioButton objects are contained in a group box, the user can select only one of the radio buttons on the panel.
    12·1 answer
  • Apple was a pioneer in user interface development, introducing the _____, complete with mouse and screen icons, in the early 198
    7·1 answer
  • You are the administrator of the Sybex website. You are working when suddenly web server and network utilization spikes to 100 p
    15·1 answer
  • What is a protein called if it loses its shape?
    8·1 answer
  • 2.8 Code Practice: Question 2
    11·1 answer
  • Fill in the blank with the correct term.
    10·2 answers
  • Software licensed as proprietary
    11·2 answers
  • Como a contribuido el desarrollo tecnologico a mejorar la calidad debida de los seres humanos
    11·1 answer
  • Select all the correct answers
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!