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
What is a well-planned strategy that ensures the search and navigation functions are easy to use and user-friendly on a website?
snow_tiger [21]

Answer:

The correct answer to the following question will be "Taxonomy ".

Explanation:

A location taxonomy seems to be the direction it helped organize the information into subgroups as well as subsections, often shown in a network map, in comparison to internet sites and access points.

  • Is a very well-planned approach that implies that somehow the navigation features on the website become straightforward to do this and feature-packed
  • The scientific method of categorizing, or classifying, items predicated on a default framework.
6 0
3 years ago
If an ______ is caught dumping hazardous materials, that person can be prosecuted. Answer choices A) Employee B) Employer C) Bot
Citrus2011 [14]

Answer:

Both A and B

Explanation:

I think it is right

hope this helps :)

5 0
2 years ago
Persons who have been given access to an installation can be counted on to be of no threat. true or false? (antiterrorism scenar
aliya0001 [1]
<span>The statement that "Persons who have been given access to an installation can be counted on to be of no threat" is false. If they are not honest enough, they could become the dangerous staff the company could ever had because he or she has access to everything, files, information, etc. That is why, in selecting a person to be trusted with such responsibility, he or she undergoes an intensive training.</span>
4 0
3 years ago
__________ is the electronic transmission of signals for communications, which enables organizations to carry out their processe
Serjik [45]

Telecommunications is the electronic transmission of signals for communications, which enables organizations to carry out their processes and tasks through effective computer networks

4 0
3 years ago
What would happen without satellites???
laila [671]

Answer: without satellites there would be no way for the world to communicate

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Whenever I go onto Google Chrome, the words are in Spanish! How can I make the words be back in English again? Please let me kno
    7·1 answer
  • A manager wants to set up an area that is not on the LAN but not quite on the Internet. This area will house servers that will s
    5·1 answer
  • Which of the following is a popular open source intrusion detection system that runs on SmoothWall?? Synchronous Dynamic Random
    6·1 answer
  • What is the base for a hexadecimal number system?
    11·1 answer
  • A Windows application which demands a lot of raw processing power to execute repetitive complex calculations is a good candidate
    9·1 answer
  • In the 1880’s advancements in technology and processes made photography available to the general public. Who is considered the m
    12·1 answer
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • If someone said to you, “Pseudocode is a waste of time! It’s just more work because you end up writing the same program twice,”
    8·1 answer
  • Write the features of Mark-I.​
    7·1 answer
  • Learning Task 2: Identify what is being asked. Write your answers on your notebook 1. What Microsoft Office program is used for
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!