Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are three situations. The user can enter negative integer, zero, or positive integer. The program should always run appropriately 3 SP2020 (8261) > Assignments

There are three situations. The user can enter negative integer, zero, or positive integer. The program should always run appropriately image text in transcribed
image text in transcribed
3 SP2020 (8261) > Assignments > Fill An Array Fill An Array Submit Assignment Submitting a file upload File Types java Due Tuesday by 8pm Points 2 Available after Sep 30, 2019 at 7:30am With your partner, brainstorm a program tha/ 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 Fill An Array 11.8. Credit Card Check Digit 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 @: -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 : 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: No digits to store? Goodbye

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions