Multiple Exceptions with Array
Good Afternoon,
I would like to learn, and need direction if possible please.
Here is my challenge.
I want to pull from an Array of multiple "error messages" when the user inputs the incorrect data.
This is my array:
Code:
import java.util.*;
public class OrderMessages
{
public static void main(String[] args)
{
String[] errorMessages = new String[7];
errorMessages[0] = "The Item is not numeric";
errorMessages[1] = "The quantity is not numeric";
errorMessages[2] = "The item number is too low";
errorMessages[3] = "The item number is to high";
errorMessages[4] = "The quantity ordered is too low";
errorMessages[5] = "The quantity ordered is too high";
errorMessages[6] = "The item number is not valid";
{
System.out.println(errorMessages[0]);
}
}
}
Then I would create a class that displays one of the messages(easy enough I think ).
Then an Applet.
The user then inputs an item number (ie 1) then a quantity.
I then assign a price to it (i.e $0.89ea)., and caluculate the math..etc...
If he/she inputs the incorrect info as per my exception array, then the error is displayed.
I'm assuming the try and catch with multiple catches.
all wrapped in an Applet.
Trying to find the correct "starting point" has been my challenge.
I've tries a couple different approaches on paper so far, but they all seem to go nowhere.
Now, I'm more confused than ever.
yes, I am a mature student, and I am learning for fun.
if I am not using proper terms etc...please let me know..
Thank you in advance
Cutter