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
solong [7]
3 years ago
7

Implement a class Rectangle. Provide a constructor to construct a rectangle with a given width and height, member functions get_

perimeter and get_area that compute the perimeter and area, and a member function void resize(double factor) that resizes the rectangle by multiplying the width and height by the given factor
Computers and Technology
1 answer:
Luba_88 [7]3 years ago
3 0

Answer:

Explanation:

The following code is written in Java. It creates the Rectangle class with the height and width variables. The constructor takes these variables as parameters to create Rectangle objects. It creates the get_perimeter method that sums up two of each side in order to get the perimeter of the Rectangle. A get_area method multiplies the height by the width to get the area. Finally, a resize method takes in a double factor variable and multiplies the height and the width by the factor to get a resized Rectangle object.

class Rectangle {

   double height, width;

   public Rectangle(double height, double width) {

       this.height = height;

       this.width = width;

   }

   

   public double get_perimeter() {

       return (this.height + this.height + this.width + this.width);

   }

   

   public double get_area() {

       return (this.height * this.width);

   }

   

   public void resize(double factor) {

       this.height *= factor;

       this.width *= factor;

   }

}

You might be interested in
Your unit has an upcoming training event. What form is used to record and maintain document numbers for ammunition documents?
aleksklad [387]

Ammunition documents which caries bullet, fuses extra should be numbered properly.

<u>Explanation:</u>

A document number or page number should be well organized and he or she coordinates with assistant trainers who have involved it.

Since it is a training event. The trainer has to have a checklist and make as fill with page number and make sure page numbers are strictly followed during the training session. If any page number is misplaced through the training session it will be embracing the situation for trainer and student or staff who get the training.

8 0
3 years ago
How does naming affect a variable’s creation and use?
Evgen [1.6K]

Answer:

Each variable is named so it is clear which variable is being used at any time. It is important to use meaningful names for variables: ... The name given to each variable is up to the programmer, but ideally a variable name should have meaning, ie it should reflect the value that it is holding.

Variables make code more than a static set of instructions. They allow logic to occur, enabling developers to measure time, analyze data, and customize the program to the user. Variables are so important to the code that they deserve a good name that accurately describes their purpose

Explanation:

4 0
2 years ago
Only one person can receive the same email at the same time true or false
nasty-shy [4]

Answer:

false

Explanation:

5 0
3 years ago
Which key do programmers use to end running programs?
Aleksandr [31]
<span>Pause/Break   i would say</span>
3 0
3 years ago
Read 2 more answers
Who wont me???????????????
Svet_ta [14]

Answer:

whatatattatata

Explanation:

what are u talking about

8 0
3 years ago
Read 2 more answers
Other questions:
  • If an occupation is projected to grow by 13% over the next 10 years, how would you rate the job outlook?
    7·2 answers
  • Which IPv6 transition technology can be used with NAT routers and has the address prefix 2001::32?
    10·1 answer
  • Determine the number of bytes necessary to store an uncompressed RGB color image of size 640 × 480 pixels using 8, 10, 12 and 14
    11·1 answer
  • Largest of five (5 points). Write an algorithm that read 5 distinct integers and displays the largest value. Assume the input va
    14·1 answer
  • What are the pros and cons of the internet’s ability to access information
    8·2 answers
  • Which of the following data recording procedures is best used for behaviors that have a clear ending and beginning, do not occur
    12·1 answer
  • In ________ for final fields and methods the value is assignedlater but in ______ you assign the value during declaration.
    15·1 answer
  • ) how many bits are used for host number on the child network (subnet) , b) how many usable addresses can exist on this child ne
    9·1 answer
  • What do I do if my friend wants me to watch a video at my house?
    8·2 answers
  • in a particular factory, a team leader is an hourly paid production worker who leads a small team. in addition to hourly pay, te
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!