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, 22.06.2019 12:10
1. declare a constant named cents_per_pound and initialize with 25. 2. get the shipping weight from user input storing the weight into shipweightpounds. 3. using flat_fee_cents and cents_per_pound constants, assign shipcostcents with the cost of shipping a package weighing shipweightpounds.
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Martha is a healer, a healthcare provider, and an experienced nurse. she wants to share her daily experiences, as well as her 12 years of work knowledge, with people who may be interested in health and healing. which mode of internet communication can martha use?
Answers: 3
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
question
Computers and Technology, 24.06.2019 02:50
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
You know the right answer?
Write And Test An Array Class [StaticArray. h and StaticArray. TestDriver. cpp]
Write a data...
Questions
question
Mathematics, 14.01.2021 04:10
question
Mathematics, 14.01.2021 04:10
question
Mathematics, 14.01.2021 04:10
question
Mathematics, 14.01.2021 04:10
question
Mathematics, 14.01.2021 04:10
question
Social Studies, 14.01.2021 04:10
Questions on the website: 13722363