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
The advantage of using a spreadsheet is:
Rama09 [41]

because it's a good thing

5 0
2 years ago
Give five functions of Windows​
Nata [24]

Answer:

Explanation:

It knows how to remember data and where to find that data. In other words, it knows how the raw memory works. (RAM).

It understands how to make a program run within the confines of its logical steps in an order that makes the program work the way the user intends.

It can be made to display short cuts, or any icon or picture (not an obvious talent).

It can search for unwanted intruders like ads or viruses.

It can can time events even to the point of getting your coffee ready for you with the proper add on.

6 0
3 years ago
You're programming an infinite loop. What must you include in your code to prevent crashes?
natta225 [31]

You have to put repeat

4 0
3 years ago
Read 2 more answers
Convert the following four unsigned binary numbers to decimal and show your work:
Ber [7]

Answer:

23 ,21,10,63,13

Explanation:

We have to convert binary to decimal

10111 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=23

10101 corresponding decimal number is

1\times 2^4+0\times 2^3+1\times 2^2+0\times 2^1+1\times 2^0==21

01010 corresponding decimal number is

0\times 2^4+1\times 2^3+0\times 2^2+1\times 2^1+0\times 2^0=10

111111 corresponding decimal number is

1\times 2^5+1\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=63

001111 corresponding decimal number is

0\times 2^5+0\times 2^4+1\times 2^3+1\times 2^2+1\times 2^1+1\times 2^0=13

7 0
3 years ago
Different uses of quick access toolbar
zhannawk [14.2K]
“The Quick Access Toolbar provides access to frequently used commands, and the option to customize the toolbar with the commands that you use most often. By default, the New, Open, Save, Quick Print, Run, Cut, Copy, Paste, Undo, and Redo buttons appear on the Quick Access Toolbar” -Information Builders
5 0
3 years ago
Other questions:
  • In a five-choice multiple-choice test, which letter is most often the correct answer?
    7·2 answers
  • How do you think computers have helped to improve documentation, support and services within the healthcare industry.
    7·1 answer
  • A student who sets a date to finish a goal is using which SMART goal? relevant, specific, attainable or timely
    10·1 answer
  • Where is the worlds biggest cookie​
    7·2 answers
  • dr. olson likes to conduct research on the nature of prejudice and its effect on behavior. dr olson is probably a (n) - psycholo
    8·2 answers
  • The Operating System is used to locate, move, and copy files.
    10·1 answer
  • You are a software engineer at a company where management routinely encourages you and your colleagues to use pirated software.
    5·1 answer
  • An opening inside the system unit in which you can install additional equipment can be known as
    13·1 answer
  • Write a recursive decent algorithm for a java while statement, a Javas if statement , an logical/mathematical expression based o
    5·1 answer
  • External hard drives typically connect to a computer via an external port (such as a usb or ____ port) or a wireless connection.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!