Question 3 Applying one of the concepts of OOP, classes, create a rectangle class Rectangle with a method void() to capture the length and the width of the rectangle. The method should check that all of the dimensions are greater than 0.0 before assigning the values to the private data members. The class also should include two value-returning method should calculate the area of rectangle, and the other should calculate the perimeter of the rectangle. The formula for calculating the area a triangle is length width. The formula for calculating the perimeter of a rectangle is (length + width) *2. The program should have appropriate variables in the class and a default constructor.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
Fast
Question 3
Applying one of the concepts of OOP, classes, create a rectangle class Rectangle with a method
void() to capture the length and the width of the rectangle. The method should check that all of the
dimensions are greater than 0.0 before assigning the values to the private data members. The
class also should include two value-returning method should calculate the area of rectangle, and
the other should calculate the perimeter of the rectangle. The formula for calculating the area a
triangle is length *
width. The formula for calculating the perimeter of a rectangle is (length
+ width) *2. The program should have appropriate variables in the class and a default constructor.
Transcribed Image Text:Question 3 Applying one of the concepts of OOP, classes, create a rectangle class Rectangle with a method void() to capture the length and the width of the rectangle. The method should check that all of the dimensions are greater than 0.0 before assigning the values to the private data members. The class also should include two value-returning method should calculate the area of rectangle, and the other should calculate the perimeter of the rectangle. The formula for calculating the area a triangle is length * width. The formula for calculating the perimeter of a rectangle is (length + width) *2. The program should have appropriate variables in the class and a default constructor.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT