Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The app lets its user enter as many values as they like, and when that process is completed, lets the user look up values by

The 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.

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 whole-number 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. For this part, do validate input indexes in the app -- don't access the Array objects with out-of-range indexes.

Your app should keep track of which indexes got entered. Use a second Array for that, with whatever integer codes you wish to distinguish used indexes from those never used.

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 234 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]: 35 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

Language in Context?

Answered: 1 week ago