Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Complete this problem on Sheet2. The location of an object can be described by its x and y coordinates. Let's say that you
2. Complete this problem on Sheet2. The location of an object can be described by its x and y coordinates. Let's say that you want to know the distance between two mountain peaks. The first peak is located at (x1, yl) and the second peak is located at (x2, y2). y (x2, y2) y2-yl (x1, yl) (0,0) 2 1 The distance, d, between two points in space can be calculated by using the following equation: d- J(x, - x,' + (y; y,) Type the values of x1 and yl into cells B1 and B2. Next type the values of x2 and y2 into cells DI and D2. Then create a macro named caledist that will accomplish the following tasks: Obtain the values for x1 and yl from the worksheet and store them in variables Obtain the values of x2 and y2 from the worksheet and store them in variables Calculate the distance between the two mountain peaks and store this value in a variable Output the distance to cell C5 Create a run button on Sheet2 that will execute the macro calcdist. Before clicking the run button, make sure that you input the values of x1 and yl in cells BI and B2, and input the values of x2 and y2 into cells DI and D2. To test your code, try typing 2 and 4 into cells B1 and B2, and type 5 and 6 into cells D1 and D2. Then click the run button. The distance between the two points is, d- (5- 2) + (6- 4)* - V3 +2 - V13 - 3.606 If the units of x1, yl, x2, and y2 are miles, then the two peaks are about 3.6 miles away other.
Step by Step Solution
★★★★★
3.53 Rating (146 Votes )
There are 3 Steps involved in it
Step: 1
Stepl Open an excel and enter values in cells B1B2C1 and C2 a...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
Document Format ( 2 attachments)
635e27b1e2596_181928.pdf
180 KBs PDF File
635e27b1e2596_181928.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started