Question: Create a new C# class library (dynamic link library) and create the following classes. Call the project DLLExample. Class Circle and functions Circumference and Area.
Create a new C# class library (dynamic link library) and create the following classes. Call the project DLLExample.
Class Circle and functions Circumference and Area. Both circumference and area accept one parameter - the radius of a circle - and calculate, respectively, the area and the circumference based on the radius passed in.
Class Rectangle and functions Perimeter and Area which both accept two parameters, height and width and calculate the perimeter and area of the rectangle based on these.
Class Person which accepts a date and calculates the age of the person based on that date.
Build the class library project.
Create a new windows form project (called ObjectExample) and add a reference to the dll created above.
On a form, add a textbox for the radius of a circle and two buttons calculate circumference and calculate area. Call the dll function to do this and show the radius and circumference in a messagebox or in a textbox.
Add 2 textboxes, Height and Width and two buttons calculate perimeter and calculate area. Call the dll function to show the results of these.
Finally, add a datetimepicker to the form. Call the dll function to calculate the age of the person based on this date.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
