Question: Note: All programs must use the appropriate C + + features. Objective: Develop a C + + application that performs vector operations. This program will
Note: All programs must use the appropriate C features.
Objective: Develop a C application that performs vector operations. This program will
enable vector multiplication and division using functors and lambda expressions for
elementwise calculations. It should also robustly handle invalid operations such as differing
vector sizes and division by zero through both custom and standard exceptions.
Requirements:
NewVector Class
a Data Storage: Store data using either a vector or array.
b Operaons Support: Implement multiplication and division using functors.
Create specific classes for these operaons to encapsulate the funconality
c Operators Overloading: Overload the operators and to facilitate
vector operaons
d Constructors:
i Default Constructor: NewVectorint numelem Inialize the
NewVector with random values using lambda expressions.
ii Parameterized Constructor: Inialize the NewVector with provided
input values, eg a vector or array.
Custom Excepon Class
a Define a VectorOperaonExcepon class to address specific vector operaon
errors such as mismatched dimensions and zerodivision.
Excepon Handling
a Implement trycatch blocks to eciently manage excepons during vector
operaons
Modify the given main funcon to achieve the following features:
a User Interface: Design an interface that connuously interacts with the user
unl they opt to quit, gracefully handling incorrect data entries.
b Input Handling: Enable users to specify the number of elements for two
NewVectors, with an opon to inialize using the default constructor or
manually input values.
c Operaon Demonstraons: Show successful vector operaons and handle
excepons where operaons fail, such as mismatched dimensions or zero
division. Therefore, there are at least three test cases: one successful case,
one error case due to mismatched dimensions, and one error case due to
zero division.
The input and output should be like below:
Input & Output:
Modify the given weekcpp to achieve the result like below.You should have one successful case, one error case due to mismatched dimensions, and
one error case due to zero division.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
