Question: using visual-studio 2019 create a project under the .net framework on c# below is the program name distance using c# 1-Modify this program to use

using visual-studio 2019 create a project under the .net framework on c# below is the program name distance using c#

1-Modify this program to use a static method to calculate distance; show me the screen result

2-Modify the program to use a non-static method to calculate distance; show me the screen result 3 - what is the difference in your computer memory when using the static vs non-static method

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

1 Expert Approved Answer
Step: 1 Unlock

Lets break this problem down into several steps Step 1 Modify to Use a Static Method First well refactor the code to use a static method to calculate the distance between two points Heres how you can ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!