Question
please I need help with this c programming pro Project Description: In this project, you will develop a calculator for vectors. Your program will .ask
please I need help with this c programming pro
Project Description:
In this project, you will develop a calculator for vectors. Your program will .ask the user
to read in two vectors X and Y. The user will first enter the length of each vector and followed by each element of the vector. The maximum vector length is 10.
Enter the vector length (maximum 10): 4
EntervectorX: 2.342-3.45 5 12.33
Enter vector Y: 4.5 -5 0 10.788
Then your program will display a menu of options and ask the user to choose one of the options repeatedly until the user chooses the exit (option 8). Below is a list of options and their descriptions:
Option | Description | ||
1 | Display vector (precision is 2) | ||
2 | Calculate the sum of all the elements of the vector | ||
3 | Calculate the length of the vector | ||
4 | Display negation of the vector | ||
5
| Display addition of vectors X and Y | ||
6 | Display subtraction of vectors X and Y | ||
7
| Calculate the inner-oroduct of vectors X and Y | ||
8 | Exit the prooram |
Option 1:
This option simply displays both vectors in the following required format with precision 2. Separate the elements by commas followed by a single space.
Sample output:
X: (2.34, -3.45, 5.00, 12.33)
Y: (4.50, -5.00, 0.00, 10.79)
Option 2:
This option calculates and displays the sum of all the elements of each vector. Sample output:
Sum of elements of Xis 16.22 Sum of elements of Y is 10.29
Option3:
This option calculates and displays the length of each vector, i.e., square root of the sum of
square of each element in the vector.
The length of the vector X =.square root of (x1^2+x2^2+...+x^n)
Sample output:
The length of X is 13.94 The length of Y is 12.71.
Option 4
IfY = (y1,y2, Y3, ....Yn), then negation ofY gives (-y1, -Y2, -y3, .... -Yn). Sample output:
-X: (-2.34, 3.45, -5.00, -12.-33)
-Y: (-4.50, 5.00, 0.00, -10.79)
Option 5
This option calculates and displays X+Y, element by element. Sample output:
X+Y: (6.84, -8.45, 5.00, 23.12)
Option 6
This option calculates and displays X- Y, element by element. Sample output:
X-Y: (-2.16, 1.55, 5.00, 1.54)
Option 7
Tue inner product of two vectors X and Y is calculated as somme of i=1 to n xi, yi
Sample output:
The inner product of X and Y is 160.81
Option 8: Exit the program.
Error Checking:
Your program should check thoroughly for relevant errors. Upon encountering an error, the prograni should report an informative error message and handle the error accordingly. Certain errors are recoverable errors. Upon encountering such errors, the program should output a meaningful error message and continue the prograni, for example, if an invalid option is entered. Certain errors are fatal errors. Upon encountering fatal errors, the program should output a meaningful error message and exit. For example, if the length of the vector is not a positive integer or the length exceeds the maximum length.
Project Requirements:
Tue project should be well documented (comments) and properly indented. Title block is required (Name, project number, project description). Your code should be clear and well organized. Define of your own functions is highly recommended, but not required.
Submission Requirements:
When submitting your project, please submit an archive of your entire project directory. Use LIMITATIONS.txt to document anything that couldn't be fully completed or debugged. No late submissions will be accepted.
Step 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