Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C language Only using 'if', 'else', 'else if' statements Run Silent, Run Deep SpongeBob and Patrick took possession of a WWII submarine named the
In C language
Only using 'if', 'else', 'else if' statements
Run Silent, Run Deep SpongeBob and Patrick took possession of a WWII submarine named the Sword-Fish, which is diesel electric with no electronics on board and a small electrical computer, then set out to sink enemy. The compass on the sub is worn out and only the East, North, West and South markers are distinguishable, and hence can only navigate in those four directions. Write a program as follows: Asks the user for the magnitude (distance), in meters, and the heading, in degrees of the navigation to way-point one. 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 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. 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). Use the range to target for determining the torpedo spread according to the table below. + Torpedo spread (in degrees) 3 Range 100 to 300 301 to 599 600 to 899 900 to 1200 5 8 10 Use the target bearing to determine the torpedo heading according to the table below. Target bearing in degrees O to 5 >5 to 10 >0 to 20 >20 to 25 Torpedo heading will be the target bearing increased by the percentage below. 5% 7% 9% 12% Output the firing solution as follows. No input validation is required, assume user will enter values of correct type and range. Note: Create variables to store data as needed. Sample input/output: Please enter heading for waypoint 1 in degrees: 45 Please enter distance to waypoint 1 in meters: 6000 Move on heading due East for 4242.74 meters Move on heading due North for 4242.54 meters Please enter heading for waypoint 2 in degrees: 220 Please enter distance to waypoint 2 in meters: 4500 Move on heading due West for 3447.19 meters Move on heading due south for 2892.54 meters Please enter target bearing in degrees: 23 Please enter target range in meters: 500 Fire torpedoes on heading 25.76 degrees with a spread of 5 degreesStep by Step Solution
There are 3 Steps involved in it
Step: 1
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
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started