subject

Design and implement the class myarray that solves the array index out of bounds problem and also allows the user to begin the array index starting at any integer, positive or negative. every object of type myarray is an array type of 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 list(5); //line 1
myarray mylist(2, 13); //line 2
myarray 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 list 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 components are: yourlist[-5], yourlist[-4], …, yourlist[0], …, yourlist[8].
write a program to test the class myarray and then alter it in the following manner:
write a main program that tests these functions using arrays of 3 different types of your choice. fill your 3 arrays with random values for testing.
for each array, you will print the array, find the average, and then print out the average.
make sure you use meaningful variables names, and label your tests in your output.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:10, golderhadashaowtatz
Which are not examples of chronic or persistent stress? moving
Answers: 1
image
Computers and Technology, 23.06.2019 08:30, Bradgarner772
Based on your knowledge of a good network, describe what you think is a perfect network would be. what kind of information and resources could users share on this network. what would the network administrator do? what kind of communication would be used?
Answers: 1
image
Computers and Technology, 23.06.2019 14:30, qveenvslayin
The basic work area of the computer is it screen that you when you first fire up your computer
Answers: 1
image
Computers and Technology, 23.06.2019 22:00, rocksquad9125
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
You know the right answer?
Design and implement the class myarray that solves the array index out of bounds problem and also al...

Questions in other subjects: