Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this program, we will implement and test an array that throws exceptions when different potential errors occur. For example, an out-of-bounds exception, an array

image text in transcribed
image text in transcribed
For this program, we will implement and test an array that throws exceptions when different potential errors occur. For example, an out-of-bounds exception, an array length exception, exceptions to check for negative indices, or other types of potential errors could be avoided. In this assignment, you will use templates, operator overloading, namespaces, and exceptions (including at least one custom exception of your choosing). You will make a namespace for your templated class in a .h file; in your main.cpp, you will include that .h file and use that namespace. Name your templated class array or something similar - it should behave the same way the arrays provided by the Ct+ language behave as much as possible and include some exception throwing. The exception(s) that you throw should be reasonable. This program should: - Implement a templated class (array) that is complete with constructor (takes one integer parameter), destructor, an overloaded assignment operator, an overloaded [ ] operator, and a copy constructor; a "dump" method to output the array and getter for array size should also be utilized here. - Throw appropriate exceptions for anything that might cause an error or be inefficient in some way. You can use built in exceptions, but you must create at least one custom exception class and test it. - You must feature at least two exceptions > array index out-of-bounds and your custom exception. Exceptions can be caught in main, but must be thrown in the array class. - Have a namespace that contains your templated class. - Have a main function that thoroughly tests your implementation of this array class. It should test all the operations declared in the class and output what it is doing along the way to both help with debugging and prove your code works. - Have at least 5 files a header file for the templated class, a main.cpp for testing purposes, a header file for your custom exception(s) class(es), a README.txt, and a makefile. - All methods must be tested. - Use a makefile to compile and run. Make sure your executable is labeled prog3. - Use proper labels on ALL OUTPUT AND INPUT and include comments in your code. - Re-read this assignment sheet and the rubric before submitting to ensure requirements are fulfilied. - An INCOMPLETE .h file has been provided to you for the array class. This is a TEMPLATED class, so write the implementations in the same file

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

Step: 3

blur-text-image

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago