Question
given below program in c# using .net framework please do the following on this program 1-Modify the program to use a static method to calculate
given below program in c# using .net framework please do the following on this program
1-Modify the program to use a static method to calculate distance
2-Modify the program to use a non-static method to calculate distance 3 - what is the difference in your computer memory when using the static vs non-static method 4- create a dll for distance
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Distance { class Program { static void Main(string[] args) { Console.WriteLine("Please enter value for x1"); double x1 = Double.Parse(Console.ReadLine());
Console.WriteLine("Please enter value for y1"); double y1 = Double.Parse(Console.ReadLine()); Console.WriteLine("Please enter value for x2"); double x2 = Double.Parse(Console.ReadLine()); Console.WriteLine("Please enter value for y2"); double y2 = Double.Parse(Console.ReadLine());
double XdiffSquared = (x2 - x1) * (x2 - x1); double YdiffSquared = (y2 - y1) * (y2 - y1); double differenceSquared = XdiffSquared + YdiffSquared; double distance = Math.Sqrt(differenceSquared); Console.WriteLine("The difference between two points is {0}", distance); Console.ReadLine(); }
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started