subject

Write And Test An Array Class [StaticArray. h and StaticArray. TestDriver. cpp]
Write a data structures template. The resulting template can be used in any program in place of a C++ array, without having to copy/paste the class code the way you did with class Array in Lab Assignment 1.

Requirements. Develop StaticArray. h as you write StaticArray. TestDriver. cpp with class StaticArray, defined and fully tested. Write the public interface exactly as specified below -- do not add to, or change the public interface as specified.

Write the template for an array of values of unspecified type.

Let the capacity be set as part of the template specification, as modeled in the reading.

Include a square bracket getter and a setter, both with index range-checking, returning whatever value you wish, if out of range.

Include a getter named StaticArray::capacity( ) to return the data structure's capacity.

Initialize all data members to their default values in the constructor. That includes setting the array elements to their default data type.

Do tests with int , double , or char . Also do tests with an object, like string .

Do NOT write any other functions in the public interface.

PART 2

Write An Array Application [MyStaticArray. cpp]
Write MyStaticArray. cpp using your StaticArray template. Use your already-tested and verified H file from part 1.

Exactly as in Lab Assignment 1's MyArray. cpp, this app lets its user enter as many values as they like, and when that process is completed, lets the user look up values by matching index. Except that these values are doubles. Use a StaticArray object of capacity 100 to track the values.

In a loop, the app should prompting the user to enter a pair of numbers on the same line: a whole number index and its corresponding floating point value. Do not validate input in the app, because your template should handle out-of-range indexes, and it should allow overwriting an already-entered index. Quit the loop when an uppercase or lowercase Q is entered for either the index or the value. Indexes can be entered in any order -- they don't have to start with zero and go up by one thereafter. It's whatever the user enters.

Your app should keep track of which indexes got entered. Use a bool StaticArray for that.

After all data entry is complete, the app should:

output how many (unique) indexes got entered,

output the list of all used indexes and their values, per the example below, and

implement an event-controlled loop that prompts for an index value and outputs whether the index is in use or not, and if in use, what is the

value stored for that index. Loop until the user elects to stop by entering uppercase or lowercase Q.

Here's a sample of how this should work (user input in blue):

Input an index and a value [Q to quit]: 33 12
Input an index and a value [Q to quit]: 4 100
Input an index and a value [Q to quit]: 5 300
Input an index and a value [Q to quit]: x 17
Input an index and a value [Q to quit]: 33 120
Input an index and a value [Q to quit]: -1 23.4
Input an index and a value [Q to quit]: 2000 -999
Input an index and a value [Q to quit]: q

You stored this many values: 4
The index-value pairs are:

0 => 17
4 => 100
5 => 300
33 => 120

Input an index for me to look up [Q to quit]: 33
Found it -- the value stored at 33 is 120
Input an index for me to look up [Q to quit]: 38
I didn't find it
Input an index for me to look up [Q to quit]: 0
Found it -- the value stored at 0 is 1.7
Input an index for me to look up [Q to quit]: -100
I didn't find it
Input an index for me to look up [Q to quit]: 1000
I didn't find it
Input an index for me to look up [Q to quit]: Q

Design the prompts and the output formatting as you like.

And remember the identification comment code block and the identification cout code block!

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
What must you do before formatting a paragraph?
Answers: 1
question
Computers and Technology, 22.06.2019 10:20
Print "usernum1 is negative." if usernum1 is less than 0. end with newline. convert usernum2 to 0 if usernum2 is greater than 10. otherwise, print "usernum2 is less than or equal to 10.". end with newline
Answers: 3
question
Computers and Technology, 22.06.2019 15:00
The three logical operators used to write compound conditions are "and," "or," and "not." a: true b: false
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
Which cultural aspect does this type of song best portray? a german polka dance
Answers: 1
You know the right answer?
Write And Test An Array Class [StaticArray. h and StaticArray. TestDriver. cpp]
Write a data...
Questions
Questions on the website: 13722360