Menu
support@authoritypapers.com
+1(805) 568 7317

1 modify the classes project in the visual c step by stepchapter 7classes folder by 5148660

1. Modify the Classes project in the Visual C# Step by StepChapter 7Classes folder by adding a new class called Line to the project. A Line class consists of two Point objects. Add a method GetLength to calculate the length of each Line object. Test a Line object by creating a line consisting of origin and bottomRight points in the DoWork method. Call the GetLength method to display the line’s length. Note: The existing Point class must be left intact. Or, if you make any changes to the Point class, private fields must not be changed to public

  • Create a new class Line which you are going to need to add an applicable constructor (s) and private fields.
  • Add a method, GetLength, method to the Line class. Formula should be similar to the DistanceTo.
  • I personally found it convenient since we haven't been introduced to properties (which I gather are comparable to the Java getter/setter) to add the deconstructor as well.
  • Modify the main static method in the Program class to instantiate an instance of the new Line class and execute the new method and print out the results

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Classes
{
class Program
{
static void doWork()
{
Point origin = new Point();
Point bottomRight = new Point(1366, 768);
double distance = origin.DistanceTo(bottomRight);
Console.WriteLine($”Distance is: {distance}”);
Console.WriteLine($”Number of Point objects: {Point.ObjectCount()}”);
}

static void Main(string[] args)
{
try
{
doWork();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}

Create the Point class. Then, create a Line class which is made of two Point objects

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now