Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. (12 pts) We normally represent points on a Cartesian plane using their x and

ID: 3755297 • Letter: 2

Question

2. (12 pts) We normally represent points on a Cartesian plane using their x and y values. We would like to find the distance between two points on this plane represented as (x1,y1) and (x2,y2). We can compute this using the distance formula d V(x Pythagorean Theorem c2-a2 + b2 which is derived from the Write an algorithm for computing the distance between two points. For simplicity assume x2 2 x, and y2 2 y1. Use a flow chart or numbered steps (no code allowed). a. b. We world like for the distance to be as exact as possibic. Discuss any issues involved in making sure that a C progi am will compute the correct value using the form.ula above.

Explanation / Answer




Part 2:-
=======
For example, ^(1/2) is the same as taken ng the square root.
1. Read the Input values x1, y1, x2, y2
2.compute dx = x1 - x2
3.compute dy = y1 - y2
4.compute d = dx^2 + dy^2
5.Find Distance = d ^ 0.5


Part 4:-
========
for 4th Part

#include<stdio.h>
int main()
{
int x=27;
if(x%3>0)
{
x=x*2;
}
else if(x*2<=100)
{
x=x/5;
}
if(x/2*2<=x)
{
x=1337;
}
else
{
x=x+3;
}
printf("The Value of x is %d ",x);
return 0;
}
First Pass the vale 27
Then,x becomes 1337
Because first Condition is false 27%3>0 27%3 will result as Zero
So Else block will Execute
Then X becomes 5
Again Check if Condition it is true Finally X will result 1337.

Second Pass the value 50
For this Value X Becomes 1337.


Part 5:-
=======
Hi for 5th Part
First take C value as parameter in switch statement
Then, controller will identify that the value is invalid so the default block will
Excute
=>score=100.0 * (1/2)
that becomes
100.0 *.5= 50
Hence value for mark C:
Final value of Bonus=1
Final value of Score=50

Second take X value as parameter in switch statement
since for case X value there is no break statement so the controller will moves to the next case also
then, for case x: bonus= 2
in the next case bonus will become bonus=3
And Score =100.0 * 3
=> 300
since there is break statement in the case 'S' so which will stop

Hence value for mark X:
Final value of Bonus=3
Final value of Score=300
Finally take B value as parameter in switch statement
then bonus=1-1=0
and score=100.0 - 100.0 * ( bonus /2.0);
Score=100.0

Hence value for mark B:
Final value of Bonus=0
Final value of Score=100.0


Thanks for patience
I hope you like my Answer Now.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote