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
Hello can you please help with this if you want to thank you!
nikklg [1K]

Answer:

hardware and software is the answer

8 0
2 years ago
Read 2 more answers
When viewing data entered into a spreadsheet, the columns identify _____.?
AlexFokin [52]
The answer is : variables
When viewing data entered into a spreadsheet, the columns identify Variable. The variables later can be used on a formula to help you process any sort of data that is implemented within excels' formula system
3 0
3 years ago
The director of HR realizes that the KSAs currently used for hiring entry-level engineers are outdated. In order to establish wh
Vaselesa [24]

Answer:

Job analysis

Explanation:

The HR should preferably use job analysis.

6 0
3 years ago
What is a “spoof” of an ad ?
kykrilka [37]
I think a spoof of an ad is the study of an ads rhetorical devices that is what I think I am not completely sure
5 0
2 years ago
Read 2 more answers
Discuss three ways you could (or currently do) use the Excel software in your personal or professional life. Provide examples an
professor190 [17]
Both in my personal and professional life, I use the Excel software in order to create tables and lists. It's much easier to do that in Excel rather than in Word, for example, because Excel was actually created for that purpose, whereas Word was created for writing, above all. I use Excel for work to create tables of various things, such as names, emails, payments, etc. whereas I use it in my personal life to create lists of things such as movies, books, etc.
3 0
2 years ago
Other questions:
  • Use cases can be used to document both the current (As-Is) system and the future (To-Be) system. A. True B. False
    13·1 answer
  • 1. The best program to present numerical data in would be ____. a. Access c. PowerPoint b. Excel d. Word
    6·1 answer
  • A red wavy line under a word means _____. a change has been made in the text a new word was inserted in the document there is a
    11·2 answers
  • Which is the hanging indent on the ruler?
    10·2 answers
  • 1. Write program, WriteData.java, that writes the following data to file books.txt. Include the semicolons. Fiction;Abraham Linc
    11·1 answer
  • Last week, a disk containing CSM Tech Publishing’s current project manuscripts crashed. Fortunately, there was a backup, but all
    15·1 answer
  • a machine needs a minimum of 100 sec to sort 1000 names by quicksort what is the approximate worst case time needed to sort 100
    13·1 answer
  • Let’s say you’re having trouble locating a file on your computer. Which of the following are good places to look for the file?
    14·1 answer
  • Write a pseudocode that receives a positive number from the user, and then,
    14·1 answer
  • When the CPU performs the work described in the commands,
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!