Explore BrainMass

Modification of Class

This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

I need to modify the PerimeterCalc class so that a caller who has a square plot will be able to provide only one argument value for length and width (rather than two that are just the same) in the method invokation.

I'm pretty sure I need to add another constructor but then what about the compute part?

Class PerimeterCalc
private PlotNumber
private Length
private Width
private Perimeter
public PerimeterCalc
PlotNumber = "None"
Length = 0.0
Width = 0.0
Perimeter = 0.0
public PerimeterCalc (AnyPlot, AnyLength, AnyWidth)
PlotNumber = AnyPlot
Length = AnyLength
Width = AnyWidth
Perimeter = 0.0
public GetMeasurements
Input PlotNumber, Length, Width
public ComputePerimeter
Perimeter = (2.0 * Length) + (2.0 * Width)
public ShowResults
Display PlotNumber, Perimeter
End Class

© BrainMass Inc. brainmass.com March 21, 2019, 3:05 pm ad1c9bdddf

Solution Preview

Yes, you should add this constructor:

public PerimeterCalc (AnyPlot, ...

Solution Summary

Modification of Class is achieved.