Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part1: StartingfromthearrayListType.h(attachedwiththisassignment)and withoutusinganyofthepredefinedmemberfunctions ,Writetherequiredcodetodothefollowing: Modify the arrayListType class by adding a member function that increment or decrement(operation will be specified as a character parameter) each

Part1:StartingfromthearrayListType.h(attachedwiththisassignment)andwithoutusinganyofthepredefinedmemberfunctions,Writetherequiredcodetodothefollowing:

  1. Modify the arrayListType class by adding a member function that increment or decrement(operation will be specified as a character parameter) each element in the list by a constantnumber that is also passed as a parameter. This member function does not return any value.Forexample,ifthelistLcontainstheelements

2,1,3,4,5,3,0

and you call the member function as inL.changeByConstant('+', 3);

The list content will then be changed to5,4,6,7,8,6,3

andyoucall thememberfunctionasin

L.changeByConstant('-',3);

Thelistcontentwillthenbechangedto

-1,-2,0,1,2,0,-3

  1. ModifythearrayListTypebyaddingamemberfunctionthatchecksevery2consecutiveelementsandsubtractthesmallonefromthelargerone.

For example, if the list L contains the elements2,1,3,4,5,3,0

and you call the member function as inL.checkEach2();

The list content will then be changed to1,1,3,1,2,3,0

if the list L contains the elements5,3,10,3,6,4,3

and you call the member function as inL.checkEach2();

The list content will then be changed to2,3,7,3,2,4,3

  1. Modify the arrayListType by adding a member function that duplicate each element after aspecific location that is passed to the function as a parameter and remove all the items thatarebeforethatlocation.

For example, if a list L contains the elements12,11,13,14,15,13,10

and you call the member function as inL.duplicateORremove(3);

The list content will then be changed to14,15,15,13,13,10,10

  1. Modify the arrayListType by adding a member function that creates 2 new lists from theelementsinthelist.Thefistnewlistshouldstoretheelementsthatarelessthanaparametervalueandtherestoftheelementsshouldgotothesecondlist.Theoriginallistshouldnotbemodified.The2newlistscanbereturnedfromthefunctionthrough referenceparameters.

For example, if a list L contains the elements2,1,3,4,5,3,0

And you have two other lists, L1, L2 and you call the member function as inL.split(3,L1,L2);

ThelistLcontentwillnotbechanged, listL1willcontain2,1,0andlistL2will contain3,4,5,3.

All your modifications should be performed inside the header file arraListType.h that is attached withthis assignment. After performing the modifications, you should run the file memberArrayList.cpp(attached with this assignment) without modifying it without any problems and you should get thefollowingoutput:

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions