on JAVA language Define a class named Wall. The class should have two private double variables, one to store the length of the Wall and another to store the height . _Create a default constructor that sets the length& height to 0, create a second constructor with input parameters for the of the data variables and third copy constructor. Add accessor and mutator functions to read and set both variables Add another function that returns the area of the Wall as double . Write program that tests all your constructors and functions for at least three different Wall objects
on JAVA language
Define a class named Wall. The class should have two private double variables, one to store the length of the Wall and another to store the height .
_Create a
default constructor that sets the length& height to 0, create a second constructor with input parameters for the of the data variables and third copy constructor.
Add accessor and mutator functions to read and set both variables Add another function that returns the area of the Wall as double .
Write program that tests all your constructors and functions for at least three different Wall objects
As per the requirement program is developed.
Algorithm:
Step 1: Define the required variables
Step 2: Define default constructor, parameterized constructor and copy constructor
Step 3: Write the accessor and mutator functions
Step 4: wallArea method return the area of the wall in double value
Step 5: Write the main method
Step 6: Create the objects using three different constructor
Step 7: Print the values accordingly
Step by step
Solved in 4 steps with 4 images