Write comments in your programs. Programs with no comments will receive PARTIAL credits. For each program,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write comments in your programs. Programs with no comments will receive PARTIAL credits. For each program, the following info should at least be included at the top of the C file: Author and Date created: Brief description of the program: ● input(s) and output(s): an algorithm (or description/relationship between inputs and outputs) ● Homework 5 Problem 2 (35 points): Three-dimensional vector calculation Given a vector V = <Vx, Vy, Vz>, its magnitude is calculated as |V| = |V² + V₂² + V₂2² Z Given two vectors V1 = <Vx1, Vy1, Vz1> and V2 = <Vx2, Vy2, Vz2>, the dot product is V1. V2 = V1 dot V2 = Vx1* Vx2 + Vy1* Vy2 + Vz1* Vz2 the angle (in degrees) between the two vectors is V1.V2 180 .-1 0 = cos ;) |V1|*|V2|. Use 3.14159 for TT. Write an interactive C program that * πT display options for vector calculation that a user can choose ask a user for an option (M/m for finding the magnitude, D/d for finding the dot product and angle between the two vectors, Q/q to Quit) ask a user for one vector or two vectors (depending on the option) find and display the calculation Your C program must include at least the following user defined functions: //find_magnitude accepts three input arguments and returns the vector magnitude double find_magnitude(double Vx, double Vy, double Vz); // find_dotprod_angledeg accepts two vectors and outputs the dot product and angle in degrees between two vectors void find_dotprod_angledeg(double Vx1, double Vy1, double Vz1, double Vx2, double Vy2, double Vz2, double *dotprod, double *angle_deg); Sample code execution 1: Bold entered by a user 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: A wrong option entered 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: M Enter Vx Vy Vz (separated by spaces): 1 2 3.3 magnitude of <1.00, 2.00, 3.30> is 3.9862 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: D Enter VX1 Vy1 Vz1 (separated by spaces): 1 2 3.3 Enter Vx2 Vy2 Vz2 (separated by spaces): 7.1 14.2 23.43 <1.00, 2.00, 3.30> dot <7.10, 14.20, 23.43> is 112.8190 angle between these 2 vectors is 0.0000 degrees 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: m Enter VX Vy Vz (separated by spaces): 7.1 14.2 23.43 magnitude of <7.10, 14.20, 23.43> is 28.3022 Write comments in your programs. Programs with no comments will receive PARTIAL credits. For each program, the following info should at least be included at the top of the C file: Author and Date created: Brief description of the program: ● input(s) and output(s): an algorithm (or description/relationship between inputs and outputs) ● Homework 5 Problem 2 (35 points): Three-dimensional vector calculation Given a vector V = <Vx, Vy, Vz>, its magnitude is calculated as |V| = |V² + V₂² + V₂2² Z Given two vectors V1 = <Vx1, Vy1, Vz1> and V2 = <Vx2, Vy2, Vz2>, the dot product is V1. V2 = V1 dot V2 = Vx1* Vx2 + Vy1* Vy2 + Vz1* Vz2 the angle (in degrees) between the two vectors is V1.V2 180 .-1 0 = cos ;) |V1|*|V2|. Use 3.14159 for TT. Write an interactive C program that * πT display options for vector calculation that a user can choose ask a user for an option (M/m for finding the magnitude, D/d for finding the dot product and angle between the two vectors, Q/q to Quit) ask a user for one vector or two vectors (depending on the option) find and display the calculation Your C program must include at least the following user defined functions: //find_magnitude accepts three input arguments and returns the vector magnitude double find_magnitude(double Vx, double Vy, double Vz); // find_dotprod_angledeg accepts two vectors and outputs the dot product and angle in degrees between two vectors void find_dotprod_angledeg(double Vx1, double Vy1, double Vz1, double Vx2, double Vy2, double Vz2, double *dotprod, double *angle_deg); Sample code execution 1: Bold entered by a user 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: A wrong option entered 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: M Enter Vx Vy Vz (separated by spaces): 1 2 3.3 magnitude of <1.00, 2.00, 3.30> is 3.9862 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: D Enter VX1 Vy1 Vz1 (separated by spaces): 1 2 3.3 Enter Vx2 Vy2 Vz2 (separated by spaces): 7.1 14.2 23.43 <1.00, 2.00, 3.30> dot <7.10, 14.20, 23.43> is 112.8190 angle between these 2 vectors is 0.0000 degrees 3-D Vector calculation Enter M or m to find the magnitude Enter D or d to find the dot product and angle in degrees Enter Q or q to Quit Enter your choice: m Enter VX Vy Vz (separated by spaces): 7.1 14.2 23.43 magnitude of <7.10, 14.20, 23.43> is 28.3022
Expert Answer:
Answer rating: 100% (QA)
Based on the provided information it appears that you have been tasked with creating an interactive C program that can calculate the magnitude of a ve... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What is the maximum amount of qualified expenses that a taxpayer with one qualifying child can claim for the basis of the Form 2441 credit for dependent care for TY2023?
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
summarize this article TITLE Overhead cost pools. By: Lambert III, S.J., Chen, Kung H., Internal Auditor, 00205745, Oct96, Vol. 53, Issue 5 DATA BASE Business Source Complete Internal auditors who...
-
In a survey of 106 college students, data were gathered on the number of piercings each student had and the number of classes they had skipped in the past 3 weeks. We want to determine whether there...
-
What requirement is memory management intended to satisfy?
-
Program binaries in many systems are typically structured as follows. Code is stored starting with a small fixed virtual address such as 0. The code segment is followed by the data segment that is...
-
When installing a VFD on a motor, what specification, if overlooked, can cause turn-to-turn shorts?
-
The Maggie King Hospital, a not- for- profit hospital, had the following transactions regarding its patient service billings. 1. The total services provided by the hospital to all patients during the...
-
Multiply: (3x-1) (2x + 7y-9) Select the correct
-
1. How would you describe Danielle Oviedo's approach to leadership? 2. What would you predict about Danielle's future success as a leader? Why? 3. In what ways, if any, does Danielle function as a...
-
Landen Corporation uses a job-order costing system. At the beginning of the year, the company made the following estimates: Direct labor-hours required to support estimated production Machine-hours...
-
What category of procurement is for something new that does not already exist and incurs significant developmental and capital expense on both sides?
-
What prompted the cAfter 2013, what was the executive team's plan for future growth?
-
Assume, that you could write small letters on a surface by placing atoms next to each other in the shape of that letter. Now imagine that instead of writing the letters on a thick piece of material,...
-
One major chain of stores that sold toys closed and sold products and fixtures at drastically reduced prices. Although another company has purchased the rights to the name to reopen, what was this...
-
What instrument can be used to link an ETS with a carbon tax?
-
Find the Fourier series of the function -1 for
-
Wilsons Auto Repair ended 2011 with Accounts Receivable of $85,000 and a credit balance in Allowance for Uncollectible Accounts balance of $11,000. During 2012, Wilsons Auto Repair had the following...
-
Jenny earns $34,500 in 2012. Calculate the FICA tax that must be paid by: Jenny: ..............................Soc,Sec. ..................$______________...
-
If Charles, a 16-year-old child model, earns $50,000 a year and is completely self supporting even though he lives with his parents, can his parents claim him as a dependent? Why or why not?...
-
Matthew borrows $250,000 to invest in bonds. During 2012, his interest on the loan is $30,000. Matthew's interest income from the bonds is $10,000. This is Matthew's only investment income. a....
-
International Distribution Company Pvt. Ltd. manufactures an assortment of high-performance engines for small boats. The average selling price for various units is \($575\). The associated variable...
-
A group of retired engineering professors from Singapore Polytechnic has decided to form a small manufacturing firm that will produce a full line of automation equipment. The investors have proposed...
-
Christian Dior S.A. is a successful family business with its famous fashion and perfume brands. Its latest effort in growing the business involves opening a series of international outlets to...
Study smarter with the SolutionInn App