Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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. Create a new Project named FillArray and a new class in the default packaged named FillArray.java. You and your partner should each submit a copy of your code to Carmen. Use the following template: * Short description of the program * @author YOUR NAME HERE * @author YOUR PARTNER'S NAME HERE * @version DATE HERE */ import java.util.Scanner; public class FillArray { public static void main(String[] args) { // Your code goes here 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 O 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions