skip to Main Content

Please note that this is just a preview of a school assignment posted on our website by one of our clients. If you need assistance with this question too, please click on the Learn More button at the bottom of the page to get started.

With your partner, brainstorm a program that will ask the user for a number of digits to be stored. The program should then create an array of that size and then prompt the user for numbers to fill each position in the array. When all of the positions are filled, display the contents of the array to the user.Below is a sample transcript of what your program should do. Text in bold is expected input from the user rather than output from the program.Please enter the number of digits to be stored: 5
Enter integer 0: -1
Enter integer 1: 10
Enter integer 2: 15
Enter integer 3: -6
Enter integer 4: 3
The contents of your array:
Number of digits in array: 5
Digits in array: -1 10 15 -6 3
If the user provides a negative number of digits to be stored, the program should prompt the user to input a non-negative number of digits to store:Please enter the number of digits to be stored: -1
ERROR! You must enter a non-negative number of digits!
Please enter the number of digits to be stored: 3
Enter integer 0: 0
Enter integer 1: -5
Enter integer 2: 16
The contents of your array:
Number of digits in array: 3
Digits in array: 0 -5 16
If the user asks to store 0 digits, the program should exit with a simple goodbye message:Please enter the number of digits to be stored: 0
No digits to store? Goodbye!
**NOTE: ** Your output MUST end on a new line, not at the end of a line.

Get Help Today

Struggling with this particular assignment? Learn how our team of professional writers can help you today.

Leave a Reply

Your email address will not be published. Required fields are marked *