Show any/all additional variable names and types that you choose to use. Write a
ID: 3851529 • Letter: S
Question
Show any/all additional variable names and types that you choose to use. Write a statement to convert x pounds to y grams (recall: 454 g = 1 lb). Write a statement to convert x miles/hour to y feet/sec (recall: 1 mile = 5280 feet and 1 minute = 60 seconds.) Write a statement that can be used to calculate the volume of a hollow sphere V = 4/3 pi (r_O^3 - r_ ^3), where r_O is the outer radius and r_I is the inner radius. Write a statement to calculate the distance, d, between two points (x_1, y_2) and (x_2, y_2). Recall that d is defined by: d = Squareroot (x_2 - x_1)^2 + (y_2 - y_1)^2Explanation / Answer
Hi,
Please find the answers below:
1. pounds to grams.
int x=10; //value in pounds
int y=0; //value in grams
y=454*x; //pounds converted to grams by multiplying it with 454
print y;
2. x miles per hour to y feet/sec
Satetment: y=x*5280/3600;
print y;
3. volume of sphere
volume= ((4*22)/(3*7))*((r0*r0*r0)-(r1*r1*r1));
4. Distance between 2 points
distance=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
thanks.