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
QUESTION 16
balandron [24]

Answer:

Report Wizard

Explanation:

Report Wizard is a tool that helps users quickly and easily create reports with charts, tables and drill-down capabilities

4 0
3 years ago
A group of computers that are interconnected order to share information or document is called a
Shkiper50 [21]
Group of computers that are interconnected in order to share information or documents is called <span>Computer network.



                                                            
Hope this helps.
</span>
5 0
3 years ago
Read 2 more answers
If $350 is the profit of an initial investment of $1000.00, what is the percentage profit?​
umka2103 [35]

Answer:

35%

Explanation:

1000x=350

x=350/1000

x=0.35

35%

6 0
3 years ago
Read 2 more answers
2. Why do old video games have large pixels and images with jagged edges?
egoroff_w [7]

Answer:

A

Explanation:

cuz yea

3 0
2 years ago
________ are typically comprised of a mix of ________ and ________.
zaharov [31]
Your answer is "Mutual funds; stocks; bonds".
8 0
4 years ago
Read 2 more answers
Other questions:
  • What following functions does browser perform
    5·1 answer
  • What do you think is the most fascinating aspect of the internet?
    14·1 answer
  • A parameter is a numerical measure that describes a characteristic of a sample. Choose One • 4 points True False
    6·1 answer
  • Which item is essential to know before sketching a navigation menu flowchart? template specifics, such as horizontal or vertical
    12·1 answer
  • PLS ANSWER QUICK!!!!
    12·1 answer
  • ________ development is the term used to describe an information system development methodology that emphasizes flexibility and
    11·1 answer
  • The declaration of variables begins with a command a. dim b. rem c. const​
    8·1 answer
  • Which of the following is not System Software?
    5·1 answer
  • ¿Por qué en Colombia la mayoría de las empresas no son automatizadas (manejadas por computadoras y robots?
    15·1 answer
  • Which of these are the two main components of a CPU?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!