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
Drivers must always yield to emergency vehicles traveling
alina1380 [7]

True. Drivers must always yield to emergency vehicles traveling. Emergency vehicles always have the right of way, and other cars on the road need move out of their way when they see them driving with their hazards on. If there are no emergency lights or sirens, then it is okay to treat these vehicles like another vehicle on the road.

4 0
4 years ago
In ancient times what did kings and tribals chiefs use to communicate
mel-nik [20]

Answer:

they used sign language to communicate and also pegion was used to communicate

8 0
3 years ago
FIRST AMSWER GET BRAINLIEST​
MA_775_DIABLO [31]

Answer:

agile --> business modeling

RAD --> pair programing

waterfall --> deployment

spiral --> risk analysis

v-shaped model --> integration testing

not too sure about this but i tried

4 0
3 years ago
What is an input to the Program Increment Planning process that highlights how Product Management plans to accomplish the Vision
Tatiana [17]

Answer:

Business Context

Explanation:

The input "business context" is an input to Program Increment Planning that helps understand what is the vision in Product Management.

6 0
3 years ago
What department is cyber security
Paul [167]

Answer:

United States Department of Homeland Security

The National Cyber Security Division (NCSD) is a division of the Office of Cyber Security & Communications, within the United States Department of Homeland Security's Cybersecurity and Infrastructure Security Agency.

<em>Give</em><em> </em><em>me</em><em> </em><em>brainliest</em><em> </em>

8 0
3 years ago
Read 2 more answers
Other questions:
  • The ListIterator interface
    13·1 answer
  • which of the following sentences uses active voice?(answers to choose from are in the photo)-this is in my computer applications
    14·2 answers
  • What is Linux an example of
    6·1 answer
  • What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
    10·1 answer
  • Which line of code will print I can code on the screen?
    13·1 answer
  • Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
    11·1 answer
  • . If you have written the following source code:
    9·1 answer
  • Communication is defined as__________.
    10·1 answer
  • Uploading Your Work
    14·1 answer
  • G i r l s o n l y j o i n <br> id= ons jcuv jke
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!