Reference no: EM13943188
Please assist with the following problem. I am totally lost with this so if you could also include statements telling me what you did, I would appreciate it. The entire chapter talks about array index out of bounds which has completely confused me and there are no examples in the book to help. If you could complete this program, it will help me to better understand how this works and what it is used for.
Program Problem
Design and implement the class myArray that solves the array index out of bound problem and also allows the user to begin the array index starting at any integer, positive or negative. Every object of the type myArray is an array of type int. During execution, when accessing an array component, if the index is out of bounds, the program must terminate with an appropriate error message. Consider the following statements;
myArray<int> list(5); //Line 1
myArray<int> myList(2,13); //Line 2
myArray<int> yourList(-5,9); //Line 3
The statement in line 1 declares list to be an array of 5 components, the component type is int, and the components are: list [0], list [1], ..., list [4];
The statement in line 2 declares myList to be an array of 11 components, the component type is int, and the components are;
myList[2], myList[3], ..., myList[12];
the statement in line 3 declares yourList to be an array of 14 components, the component type is int, and the componest are:
yourList[-5], yourList[-4], ..., yourList[0], ..., yourList[8].
Write a program to test the class myArray.
When using the discounted free cash flow model
: The firm's weighted average cost of capital, denoted rwacc, is the cost of capital that reflects the risk of the overall business, which is the combined risk of the firm's equity and debt. When using the discounted free cash flow model we should use ..
|
Performance and reward management scheme
: You work for an organization operating in the built environment sector. Senior management have tasked you with producing a new performance and reward management scheme to successfully embed sustainability into the culture of the organization.
|
New sausage system with an installed cost
: Parker is looking at a new sausage system with an installed cost of $480,000. This cost will be depreciated straight-line to zero over the project's five-year life, at the end of which the sausage system can be scrapped for $70,000. The sausage syste..
|
Write a program to test the class myarray.
: Design and implement the class myArray that solves the array index out of bound problem and also allows the user to begin the array index starting at any integer, positive or negative
|
What is probability-annual return on small-company stocks
: Assume that annual returns on small-company stocks are normally distributed with an average historical return of 17.1% and a standard deviation of 32.6%. What is the probability that annual return on small-company stocks is positive? Show all work.
|
Provide a current example of a compelling news story
: After studying the assigned reading 21st Century Communication: A Reference Handbook: Chapter 65: The Changing Nature of "News" considering the concepts of timeliness, proximity, unusualness, prominence, impact, conflict and human interest, provid..
|
Determine pounds of quicklime and soda ash
: A lime-soda softening plant treats a flow of 150 MGD, and the water has 86mg/l Ca2+, 35 mg/L Mg2+, 299 mg/L HCO3- and 6mg/l CO2. The commercial grade of quicklime has a purity of 85% and the soda ash has a purity of 95%. Determine the pounds of qu..
|
Many projects use a resource that the company already owns
: Many projects use a resource that the company already owns. When evaluating a capital budgeting decision, we generally include interest expense. Only include as incremental expenses in your capital budgeting analysis the additional overhead expenses ..
|