Java Using Exception Handling
$19.99
Description
Program Specifications:
Prompt the customer for their age. If they enter an age that is not an integer value, it means that they do not want to participate in the survey. Use a try block to detect this situation, and a catch block to display a message telling them the customer that you understand they do not want to participate.
If the customer enters their age, it means that they do want to participate in the survey. Prompt them for the name of a file that contains standardized, two character abbreviations for each state, along with the names of the states. Use a try block to detect the situation in which the file cannot be opened, and a catch block does display a message telling the customer that the file cannot be opened. Read the contents of the file into a 52 row x 2 column array.
Prompt them for the standardized, two character abbreviation of their home state (don’t be case sensitive). Compare the value they entered against the contents of the state information array. Prompt the user for their five digit zip code. Use a try block to detect the situation in which the zip code entered is not an integral value, and a catch block to display a message to the customer.
Display the customer’s age, state name and zip code, and display a message telling the customer their participation is valuable.
Use a final clause associated with the first try block to display a message that thanks the customer for participating in the survey.
SCREENSHOTS
SOLUTION
PAYMENT
The solution consists of:
A report word document for this assignment
All Java programs and classes
A Netbeans project in case you want to run the project on your computer.
Screenshots showing program running
Attachments [Move over files to preview content of those files]
Java_Exception_Handling.zip (239.28 KB)
Java code and Dataset
Main.class
Main.java
states.dat
Netbeans project
ExceptionHandling
pom.xml
src
main
java
Main.java
test
java
states.dat
target
classes
Main.class
generated-sources
annotations
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst
inputFiles.lst
test-classes
Screenshot-1.jpg
Screenshot-2.jpg
Screenshot-3.jpg
Preview Main.java
xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) {
xxxxxx.xxx.xxxxxxx(“xxxxx xxxx xxx: “);
// xxxxxx.xx xxxxxxxxxx xxxxxxxx xxxxx xxxxxx (xxxxxxxx)
xxxxxxx xx = xxx xxxxxxx(xxxxxx.xx);
int age=0; try { age = in.nextInt(); if (age <= 0) { throw new Exception("Invalid dage!!!"); } } catch (Exception ex) { System.out.println("Your age you have entered is not a positive integer number.
Please enter the correct age if you want to participate"); return; } String fileName; System.out.println("Enter name of a file that contains standardized, two character abbreviations for each state, along with the names of the states:");
xxxxxxxx = xx.xxxx();
xxxxxx[][] xxxx = xxx xxxxxx[52][2];
xxx {
xxxx xxxx = xxx xxxx(xxxxxxxx);
// xxxxxxxx xx xxxxxx xx xxxxxxxxxxxxxx xxxxx
xxxxxxxxxxxxxx xx = xxx xxxxxxxxxxxxxx(xxx xxxxxxxxxx(xxxx));
Preview Main.java
xxxxxx xxxxxx xxxx xxxx(xxxxxx[] xxxx) {
xxxxxx.xxx.xxxxxxx("xxxxx xxxx xxx: ");
// xxxxxx.xx xxxxxxxxxx xxxxxxxx xxxxx xxxxxx (xxxxxxxx)
xxxxxxx xx = xxx xxxxxxx(xxxxxx.xx);
int age=0; try { age = in.nextInt(); if (age <= 0) { throw new Exception("Invalid dage!!!"); } } catch (Exception ex) { System.out.println("Your age you have entered is not a positive integer number.
Please enter the correct age if you want to participate"); return; } String fileName; System.out.println("Enter name of a file that contains standardized, two character abbreviations for each state, along with the names of the states:");
xxxxxxxx = xx.xxxx();
xxxxxx[][] xxxx = xxx xxxxxx[52][2];
xxx {
xxxx xxxx = xxx xxxx(xxxxxxxx);
// xxxxxxxx xx xxxxxx xx xxxxxxxxxxxxxx xxxxx
xxxxxxxxxxxxxx xx = xxx xxxxxxxxxxxxxx(xxx xxxxxxxxxx(xxxx));
Price: $35
Buy Now
Checkout
Added to cart
Add to Cart
Checkout
Added to cart
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.