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, 23.06.2019 10:20
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
question
Computers and Technology, 23.06.2019 11:20
Http is the protocol that governs communications between web servers and web clients (i.e. browsers). part of the protocol includes a status code returned by the server to tell the browser the status of its most recent page request. some of the codes and their meanings are listed below: 200, ok (fulfilled)403, forbidden404, not found500, server errorgiven an int variable status, write a switch statement that prints out the appropriate label from the above list based on status.
Answers: 2
question
Computers and Technology, 23.06.2019 15:10
What role did women fill during world war ii?
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
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
question
Mathematics, 06.05.2020 05:31
question
Mathematics, 06.05.2020 05:31
question
Mathematics, 06.05.2020 05:31
question
History, 06.05.2020 05:31
question
Arts, 06.05.2020 05:31
question
English, 06.05.2020 05:31
question
Mathematics, 06.05.2020 05:31