Answer:
Follows are the code to this question:
#include <stdio.h>//header file
int main() //main method
{
int plane, g1, g2, f;//defining integer variables
float m,a,t1,t2; //defining float variables
printf("Enter mass of airplane (kg)-> ");//print message for input value
scanf("%d", &plane);//input value
printf("Enter mass of glider #1 (kg)-> ");//print message for input value
scanf("%d", &g1);//input value
printf("Enter mass of glider #2 (kg)-> ");//print message for input value
scanf("%d", &g2);//input value
printf("Enter force produced by propellers (N) -> ");//print message for input value
scanf("%d", &f);//input value
m= plane + g1 + g2;//use float variable m to calculate Mass
a=f/m;//use float variable a to calculate Acceleration
printf("\nAcceleration: %.2f m/s^2", a);
printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");//use print method for design
t1 = (g1 + g2) * a;//using the t1 variable to calculate tensions
printf("\nResulting tension on cable #1: %.2f Newtons", t1);//print tension value
t2 = g2 * a;//using the t1 variable to calculate tensions
printf("\nResulting tension on cable #2: %.2f Newtons", t2);//print tension value
printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");//use print method for design
return 0;
}
Output:
Please find the attached file.
Explanation:
In this code four integer variable "plane, g1, g2, and f" and four floating-point variables "m, a, t1, and t2" is declared, in which the integer variable is used for input the value from the user-end.
In the next step, the "m" variable is used, which adds the "plane, g1, and g2" integer value to calculate mass, and in the "a" variable it calculates the acceleration, and in the "t1 and t2" variable it calculates the tension and prints its value.
Here is the API for a robot library. // moves the robot forward function moveForward(); // turns the robot to the left function rotateLeft(); // turns the robot to the right function rotateRight(); // checks if a robot can move in any direction // direction {string} - the direction to be checked // return {Boolean} - true if the robot can move in that direction, otherwise returns false function canMove(direction); Which code segment will guarantee that the robot makes it to the gray square without hitting a wall or a barrier (black square)
Answer:
Option (A)
Explanation:
See attachment for options
From the options, the code segment of option (A) answers the question and the explanation is as follows:
I added a second attachment which illustrates the movement
function (solveMaze) {
moveForward(); ---- The robot moves up (to position 1)
moveForward(); ---- The robot moves up (to position 2)
rotateRight(); ---- The robot changes where it faces (however, it is still at position 2)
while(canMove("forward")) { moveForward(); } ---- This is repeated until the robot reaches the end of the grid (i.e. position 3 and 4)
rotateLeft(); ---- The robot changes where it faces (however, it is still at position 4)
moveForward(); ---- The robot moves up to the gray square