Question
Create a Java program that has a 10 element array of Integers. The program should assign test values to all 10 array locations. You can
Create a Java program that has a 10 element array of Integers. The program should assign test values to all 10 array locations. You can get these numbers from the user or initialize them as you see fit.
The program should ask the user (in a Console screen or have Textboxes, JOptionPanes, or other GUI components to accept the values) for an array position, retrieve the value at that location, and then ask user for a new value and use it to replace the original value at that location. Demonstrate a Multiple Exception Catch Try/Catch structure that only puts valid numbers in valid positions and checks for: (1) The program trying to put a value in an element that the array doesn't have and give an appropriate message to the user (2) The user entering a String value (like "Five") instead of a numeric integer value (like 5) and give an appropriate message to the user.
After that (or under a different control or set of controls if you did a GUI instead of a Console program) have the Program ask the user for two number positions 0-9 and show what the answer is when the value at the first position (the user chose) of the Array is divided by the value at second position (the user chose) . Make sure this is in a Try/Catch structure that gives an appropriate message if the value at second position (the user chose) of the array is zero (instead of doing it and crashing the program.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started