Explore BrainMass
Share

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
End
public PerimeterCalc (AnyPlot, AnyLength, AnyWidth)
PlotNumber = AnyPlot
Length = AnyLength
Width = AnyWidth
Perimeter = 0.0
End
public GetMeasurements
Input PlotNumber, Length, Width
End
public ComputePerimeter
Perimeter = (2.0 * Length) + (2.0 * Width)
End
public ShowResults
Display PlotNumber, Perimeter
End
End Class

© BrainMass Inc. brainmass.com March 21, 2019, 3:05 pm ad1c9bdddf
https://brainmass.com/computer-science/web-design/modification-class-141880

Solution Preview

Yes, you should add this constructor:

public PerimeterCalc (AnyPlot, ...

Solution Summary

Modification of Class is achieved.

$2.19