Question Details

(Solved) LAB #8 - Polymorphism, C++ Templates, and Exceptions Each lab will begin with a brief demonstration by the TAs for the core concepts examined in this...


Hi sir, Can you help me do this lab? The document you can download directly. Feel free ask me, if you have any questions.

Also please do the extra credit for me, i would like pay tip for that work.

LAB #8 – Polymorphism,
C++ Templates, and Exceptions
Each lab will begin with a brief demonstration by the TAs for the core concepts examined in
this lab. As such, this document will not serve to tell you everything the TAs will in the demo. It
is highly encouraged that you ask questions and take notes.
In order to get credit for the lab, you need to be checked off by the end of lab. You can earn a
maximum of 3 points for lab work completed outside of lab time, but you must finish the lab
before the next lab. For extenuating circumstances, contact your lab TAs and Jennifer ParhamMocello. Pair Programming
In this lab, you can choose a partner for pair programming. You must be checked off
together. You only need one computer for pair programming. One person will be the
driver, who controls the computer and codes, while the other is the navigator, who observes
and advises. After 20 minutes, your TA will switch driver and navigator, continuing this pattern
until the task is complete. Please read more about pair programming and the benefits: Pair
Programming Student Handout (2 pts) Polymorphism and Pure Virtual
Based on your current Pokemon Go assignment, answer the questions below about
polymorphism. Which function(s) are you going to make polymorphic?
How will you make it polymorphic?
Can it be a pure virtual function?
Which class will you make an abstract base class? (5 pts) Templated Class and Exceptions
Create your own templated vector class and compare it with the std::vector class.
Copy this vector.hpp file (or download) and try_vector.cpp file (or download). This current
implementation doesn’t have a capacity!
You need to finish implementing the Big Three, since the vector has dynamic memory.
Copy Constructor:
vector(vector<T> &other){ … }
Assignment Operator Overload:
void operator=(vector<T> &other){ … }
Make sure all of this works before moving forward! (3 pts) Adding Functions and Exceptions
After you have convinced yourself and the TAs that your templated vector class constructors
and big three are working, then you can move forward toward implementing the rest of the
class. To begin, implement the following functions:
T operator(int);
T at(int); //Only perform address arithmetic //Check to make sure not out of bounds In addition, throw an exception from the at() function in the vector template class you created.
This function should throw an out_of_range exception, when the user tries to access an element outside the bounds of the vector. You need to add the statement below to at().
throw std::out_of_range(“out of my vector bounds”);
First, run your program with trying to access out of bounds memory using the at() function to
see what it does now that your function throws an exception, and you are not catching it.
Now, catch the exception so that it doesn’t have a run-time error!!! Remember, you can use
the what() member function to see your message from the out of range exception.
You will also need to add using std::exception or using std::out_of_range for these types,
since we are not bring in the whole std namespace to control which vector we are using!!!
Remember, you and your partner will not receive lab credit if you do not get checked
off before leaving each lab. Once you have a zero on a lab, then it cannot be changed
because we have no way of knowing if you were there or not!!! Extended Learning/Extra Credit (3 pts): How would this change for having capacity and
size members?
What will you have to change in your vector class when you add a capacity private member?
The capacity is the actual number of elements allocated on the heap for the vector, and the
size is that number that is being used.
How would the constructors and push_back() function change? Write out a plan for the
extra constructors you might need for testing this and how the push_back() function changes
with regard to having both capacity and size members.
Implement these extra constructors and change your push_back() function to operate
correctly with capacity and size, now that they may differ.
Include a resize() and reserve() functionality.

 


Solution details:
STATUS
Answered
QUALITY
Approved
ANSWER RATING

This question was answered on: Sep 05, 2019

PRICE: $15

Solution~000200254831.zip (25.37 KB)

Buy this answer for only: $15

This attachment is locked

We have a ready expert answer for this paper which you can use for in-depth understanding, research editing or paraphrasing. You can buy it or order for a fresh, original and plagiarism-free copy from our tutoring website www.aceyourhomework.com (Deadline assured. Flexible pricing. TurnItIn Report provided)

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 05, 2019

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN YOUR SET DEADLINE.

Order Now