Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Only using 'if', 'else', 'else if' statements PLZ. Sample input/output Program2 Please enter heading for waypoint 1 in degrees: 50 Please enter distance to waypoint

image text in transcribedOnly using 'if', 'else', 'else if' statements PLZ.

Sample input/output Program2 Please enter heading for waypoint 1 in degrees: 50 Please enter distance to waypoint 1 in meters: 2671 Move on heading due East for 1716.94 meteras Move on heading due North for 2046.06 motors Please enter heading for waypoint 2 in degrees: 170 Please enter distance to waypoint 2 in meters: 8329 Move on heading due Weat for 8202.34 meters Move on heading due North for 1447.03 meters Please enter heading for waypoint 3 in degrees: 260 Please enter distance to waypoint 3 in meters: 1920 Move on heading due West for 333.66 meters Move on heading due South for 1890.79 meters Please enter target bearing in degrees: -12 Please enter target range in meters: 200 Run Silent, Run Deep Students 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 the 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 - -Decompose the vector into x and y components and output the magnitude and direction (North, West Fire torpedo on heading -11.4 degroes with a spread of 2 degrees 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 waypoints two and three. Ask the user for the target bearing (-30 to 30 degrees) and range (distance in meters). Output a firing solution as follows EMPLATE: must use this #includestdieb int main(void) - - Range 100 to 499 500 to 999 1000 to 1499 1500 to 2000 Tor x0.05 x 0.08 Bearing bearing x0.10 Bearing+ bearing x0.12 Return O; Bearing bea Target Torpedo spread 5 degrees 14 to -1 0 to 14 No input validation is required, assume user will enter values of correct type and range Note: Create variables to store data as needed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago