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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:10
The total cost of textbooks for the term was collected from 36 students. create a histogram for this data. $140 $160 $160 $165 $180 $220 $235 $240 $250 $260 $280 $285 $285 $285 $290 $300 $300 $305 $310 $310 $315 $315 $320 $320 $330 $340 $345 $350 $355 $360 $360 $380 $395 $420 $460 $460
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Budgets you to do all of the following expect a) send frivolously b) avoid over spending c) gain financial independence d) examine your priorities and goals
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Why is an outfitting a workspace with video games in a technology development company considered a strategic use of money
Answers: 1
You know the right answer?
Design and implement the class myarray that solves the array index out of bounds problem and also al...
Questions
question
Mathematics, 06.05.2021 22:50
question
Biology, 06.05.2021 23:00
question
Social Studies, 06.05.2021 23:00
question
Mathematics, 06.05.2021 23:00
question
Mathematics, 06.05.2021 23:00
Questions on the website: 13722367