Purchase Solution

Modification of Class

Not what you're looking for?

Ask Custom Question

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

Purchase this Solution

Solution Summary

Modification of Class is achieved.

Solution Preview

Yes, you should add this constructor:

public PerimeterCalc (AnyPlot, ...

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic Networking Questions

This quiz consists of some basic networking questions.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

C# variables and classes

This quiz contains questions about C# classes and variables.