Write a program that will declare an array of 10 integers and use a text-based menu-driven interface to manipulate the v

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Write a program that will declare an array of 10 integers and use a text-based menu-driven interface to manipulate the v

Post by answerhappygod »

Write A Program That Will Declare An Array Of 10 Integers And Use A Text Based Menu Driven Interface To Manipulate The V 1
Write A Program That Will Declare An Array Of 10 Integers And Use A Text Based Menu Driven Interface To Manipulate The V 1 (99.71 KiB) Viewed 38 times
Write A Program That Will Declare An Array Of 10 Integers And Use A Text Based Menu Driven Interface To Manipulate The V 2
Write A Program That Will Declare An Array Of 10 Integers And Use A Text Based Menu Driven Interface To Manipulate The V 2 (109.96 KiB) Viewed 38 times
Write a program that will declare an array of 10 integers and use a text-based menu-driven interface to manipulate the values in the array. Start up the array with all values equal to -1 (to indicate an empty position). The basic menu of the program is: 1. Show occupied places 2. Add a number 3. Remove a number 4. Change a number 5. Add up the numbers 6. Exit the program Option 1 will show a listing of the array but only the positions that are not empty (i.e. !=-1). Option 2 will allow the user to add a number. The program must ask the user enter a number which is greater than 0 and insert it in the first empty position. Notes: a. Your program must check if there are any empty positions before the user is asked for a value b. You program must ensure that the input from the user is valid (i.e. between 1 and 9999). c. You program must show the array after the insertion is complete (to confirm) Option 3 will allow the user to remove a number from the array. The program will show a listing of the elements and allow the user to select which element to remove. Once the user selects, the element will be removed (value set to -1). Note: a. Your program must check that there is at least one element in the array before showing a listing to the user to select b. You program must ensure that the selection from the user is valid c. Your program must show the array after the deletion is complete (to confirm) Option 4 will allow the user to change a number in the array. The program will show a listing of the elements and allow the user to select which element to edit. Once the user selects, then the program must ask for the new value and replace the existing value with the new value. Notes:
a. Your program must check that there is at least one element in the array before showing a listing to the user to select b. Your program must ensure that the selection from the user is valid C. Your program must ensure that the new value is NOT the same as the existing value d. Your program must show the array after the editing is complete (to confirm) Option 5 will go through the non-empty elements of the array and add them up. It will then output the resulting sum. Notes: a. Your program must check that there is at least one element in the array before attempting to sum up elements. Option 6 will terminate the program execution. Along with the assignment description, I also provide you with a collection of screen captures demonstrating the expected operation of the program. Capture1.jpg ...will demonstrate what happens if the array is empty and the user tries to output the elements, or tries to remove an element, or tries to edit an element, or tries to sumup the elements Capture2.jpg ...will demonstrate what happens when the user tries to add elements but gives wrong input, and then gives the correct values. The capture demonstrates the confirmation output after every addition and the output when using option 1. Capture3.jpg ...will demonstrate removal. The capture shows what happens if the user enters wrong values, and then gives the correct values. The capture demonstrates the confirmation output after the deletion and the output when using option 1 Capture4.jpg ...will demonstrate editing. The capture shows what happens if the user enters wrong values and then gives the correct values. The capture demonstrates the confirmation output after the editing and the output when using option 1 Capture5.jpg ...will demonstrate summing up. The capture will first add a new value (so that the gap at index 1 is closed) and then use the option 5 command to sum the elements and output the result.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply