Write a
- Ask the user for the amount of diesel loaded in the submarine.
- Asks the user for the magnitude (distance), in meters, and the heading, in degrees of the
navigation to way-point one.
- Decompose the
direction (North, West, South, or East are the only reliable headings on the sub’s
compass) of the x component and then the y component. The x component is the
magnitude multiplied by the cosine of the angle. The y component is the magnitude
multiplied by the sine of the angle. Determine compass direction depending on weather
the vector component is positive or negative.
- Calculate the amount of diesel spent to waypoint 1 and output it. Also output the
amount of diesel remaining. (The submarine has a fuel capacity of 175 metric tons of
diesel but was loaded with 1 ton in the example. The submarine spends 1 ton of diesel
per 51 miles traveled.)
- This step has to be repeated for another waypoint.
- Ask the user for the target bearing (0 to 25 degrees) and range (range in meters).
In the given question, you are asked to create a C program that performs the following tasks:
- Takes input for the amount of diesel loaded in a submarine.
- Accepts input for the magnitude and heading (direction) to waypoint one.
- Decomposes the vector into x and y components and determines compass directions for each component.
- Calculates and displays the diesel spent and remaining diesel based on a specific consumption rate.
- Provides the option to repeat these calculations for additional waypoints or targets.
Essentially, you're tasked with building a program that helps manage submarine navigation, fuel consumption, and target calculations based on user input
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
- write a function get_direction(start, end) that returns the end station that is in the direction of travel between the start and end , or None if the start and end is not on the same line. use pythonarrow_forwardWrite in C:Asks the user for the magnitude (distance), in meters, and the heading, in degrees of thenavigation to way-point Alpha.Decompose the vector into x and y components and output the magnitude anddirection (North, West, South, or East are the only reliable headings on the sub’scompass) of the x component and then the y component. The x component is themagnitude multiplied by the cosine of the angle. The y component is the magnitudemultiplied by the sine of the angle. Determine compass direction depending on weatherthe vector component is positive or negative.This step has to be repeated for waypoint bravo.Output the total distance traveled by the submarine from the starting point till itreaches point bravo.Output the distance from the starting point till point bravo (the true distance, not thedistance traveled).Ask the user for the target bearing (0 to 25 degrees, float) and range (range in meters,integer)arrow_forwardWrite a function that implements the quadratic equation. Given three inputs (a, b, and c), calculate the roots (r1 (+) and r2 (-)) of the quadratic formula. Review 19 Write a function that implements the quadratic equation. Given three inputs (a, b, and c), calculate the roots (r1 and r2) of the quadratic formula. Call your function Roots a = 1 b = 2 c = -3 [r1,r2]=Roots(a,b,c)arrow_forward
- Help Me With C Programming On their way down the river, Jojo and Lili saw two frogs in X1 and X2 respectively. The two frogs are seen jumping up and down happily in the same direction, which is coming to Jojo. After noticing the two frogs, Jojo and Lili noticed that the speed of the two frogs was different. The first frog to start jumping from the X1 position has a speed of V1, while the second frog that starts jumping from the X2 position has a V2 speed. Jojo guessed that the "YES" of the two frogs would be in the same position in a given T time, while Bibi guessed the "NO" of the two frogs would never be in the same position in that time. Help Jojo and Lili take into account the frog's movements to determine if their guess is correct. Format Input The first line of input consists of a series of integers namely X1, V1, X2, V2, T. X1 and V1 are the starting positions and jumping speeds per second of the first frog. X2 and V2 are the starting positions and jumping speeds per second…arrow_forwardCreate a C++ program to find the tiles required to complete a floor. You are given a 2-D grid as input in which 1 represent that a tile is already present on that block and 0 represnts that a tile is to be placed on that block. Return the number of tiles required to complete the floor.arrow_forwardWrite in C:Asks the user for the magnitude (distance), in meters, and the heading, in degrees of thenavigation to way-point Alpha.Decompose the vector into x and y components and output the magnitude anddirection (North, West, South, or East are the only reliable headings on the sub’scompass) of the x component and then the y component. The x component is themagnitude multiplied by the cosine of the angle. The y component is the magnitudemultiplied by the sine of the angle. Determine compass direction depending on weatherthe vector component is positive or negative.This step has to be repeated for waypoint bravo.Output the total distance traveled by the submarine from the starting point till itreaches point bravo.Output the distance from the starting point till point bravo (the true distance, not thedistance traveled).Ask the user for the target bearing (0 to 25 degrees, float) and range (range in meters,integer).arrow_forward
- in matlab pleasearrow_forwardWrite in C Asks the user for the magnitude (distance), in meters, and the heading, in degrees of the navigation to way-point Alpha. - Decompose the vector into x and y components and output the magnitude and direction (North, West, South, or East are the only reliable headings on the sub's compass) of the x component and then they component. The x component is the magnitude multiplied by the cosine of the angle. They component is the magnitude multiplied by the sine of the angle. Determine compass direction depending on weather the vector component is positive or negative. This step has to be repeated for waypoint bravo. Output the total distance traveled by the submarine from the starting point till it reaches point bravo. Output the distance from the starting point till point bravo (the true distance, not the distance traveled). Ask the user for the target bearing (0 to 25 degrees, float) and range (range in meters, integer). Output a firing solution as follows Range 100 to 300 301…arrow_forwardWrite a function in MATLAB that has two inputs: - A shear load (as the first input) - A tensile load (as the second input) Have your function return one output, a string with the name of the lowest grade material from Table 1 that can handle those loads.arrow_forward
- Initialize a vector v1 with the following values: 0 23 -7 8 -22 3 14 Write a MATLAB program from the values in v1. The vector v2 should contain the values in v1 transformed as follows: that uses a for-loop and if-statements to make a new vector v2 multiply each positive even element in v1 by 3, multiply each positive odd element of v1 by -2, and change the sign of the negative elements in v1. Then, output the new vector to the command window as follows: The new vector is: -46 7 24 22 -6 42 Also, compute and output the mean of the values in the new vector: The mean of the new vector is: xxxx Above, xxxx is the mean of the values in the new vector with 1 decimal place.arrow_forwardWrite a program in C that, given two points on a two-dimensional graph, outputs a message (string) if the line that connects them is horizontal or vertical, or if the slope is positive or negative.What would you modify or adjust in your code if we move from a 2D cartesian system to a 3D dimensional cartesian system?You need to take into consideration if the system is 3D and therefore you need to ask the user to insert X, Y , and Z.arrow_forwardPlay and practice all the functions that we listed here. What I would like you to do is to first create three vectors---a logic vector, a double vector, and a character vector, for example, x1 = c( TRUE, FALSE, TRUE) x2 = c( 0, -2.5, 1, 3, 5.9 ) x3 = c( "a1", "a2", "za", "zz", "0", "1") and apply each function to all three vectors to see what would happen. If the function requires more than one input x, then you just create other objects as needed. sum (x) sum of the elements of x prod (x) product of the elements of x max (x) maximum of the elements of x min(x) minimum of the elements of x which. max (x) returns the index of the greatest element of x which. min(x) returns the index of the smallest element of x range (x) id. than c (min(x), max (x)) length (x) number of elements in x mean (x) mean of the elements of x median (x) median of the elements of x round (x, n) rounds the elements of x to n decimals rev…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education