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
element-wise calculations. It should also robustly handle invalid operations such as differing
vector sizes and division by zero through both custom and standard exceptions.
Requirements:
1. 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: NewVector(int num_elem=10). Inialize the
NewVector with random values using lambda expressions.
ii. Parameterized Constructor: Inialize the NewVector with provided
input values, e.g, a vector or array.
2. Custom Excepon Class
a. Define a VectorOperaonExcepon class to address specific vector operaon
errors such as mismatched dimensions and zero-division.
3. Excepon Handling
a. Implement try-catch blocks to eciently manage excepons during vector
operaons.
4. 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 week6.cpp 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.
Note: All programs must use the appropriate C + +

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!