Write a program to test the class myarray.

Assignment Help Operating System
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.

 

Reference no: EM13943188

Questions Cloud

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 ..

Reviews

Write a Review

Operating System Questions & Answers

  Management has asked you to create a report

Management has asked you to create a report that details how the windows 7 operating system works. describe the fundamental and generic components of the OS. discuss how the os would handel the following, process and threads, memory management, pr..

  Delete all sub-directories within

Delete all sub-directories within "temp" directory if not empty. In Python program change the current working directory to [temp].

  Advantage of modularizing code

Imagine you are a part of a team that is tasked with writing a mobile application (app) that will allow users to send pictures to their friends. The manager does not want to waste time creating code modules. Describe at least one (1) advantage of ..

  A data structure call the gold pile and d gold-diggers

Consider a computer game that is played as follows. You have G gold-makers each of which at random times produce one unit of gold and adds it to a data structure call the goldpile and D gold-diggers each of which can grab one unit of gold from the go..

  Versions of unix

Early versions of UNIX were available only with a command-driven interface. In more recent years, graphical user interfaces have become popular. Explain in your own words why these GUIs made an impact on the popularity of this operating system.

  Automatic or traditional method to open a file

Some systems automatically open a document when it is referenced for the 1st time and close the file when the job terminates.

  Memory management activities performed by os

What are the advantages and disadvantages of having a small number of sectors per disk cluster and describe the process management and memory management activities performed by the Operating System.

  Why thread belonging to same process affected by page fault

Other user user threads belonging to the same process also be affected by the page fault (i.e., would they also have to wait for the faulting page to be brought into memory?) Explain.

  Use m8c assembler directives to allocate

Use M8C assembler directives to allocate the constants in ROM. Assume that they are all in the "lit" area.

  How much profit will your uncle have made

Which investments are being used, How much profit will your uncle have made at the end of the five years?

  Explain what components she''ll need to add or upgrade

One of Nichol's network technicians says she doesn't believe the servers are capable of handling Windows Server 2008. She adds that Nichol has:

  Determine the maximum total aggregate throughput

Consider Figure 5.26. Assume that all links are one hundred Mbps. Determine the maximum total aggregate throughput that can be achieved among the nine hosts and two servers in the network?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd