CIS 407 Week 3 Lab 5 Exercise 4 pg. 667

profilealflco

4.  Write an application that prompts the user to enter a number to use as an array size, and then attempt to declare an array using the entered size.  If the array is created successfully, display an appropriate message.  Java generates a NegativeArraySizeException if you attempt to create an array with a negative size, and it creates a NumberFormatException if you attempt to create an array using a nonnumeric value for the size.  Use a catch block that executes if the array size is nonnumeric or negative, displaying a message that indicates the array was not created.  Save the file as NegativeArray.java.

 

Week 3 Lab 5: Exercise 4 on page 667 of your text

Due in Week 3 and worth 20 points

Complete the weekly labs based on the following:

  • Write the code for each lab assignment.
  • The lab is to be submitted in a single zip file in the online course shell, which must contain all .java files, along with any additional files that may be necessary for your project to run (ex: text files). 
  • Any and all written answers must be entered into the online course shell with the submission of the attached lab assignment.

Each lab assignment will be graded based on the following: 

  1. The program must compile, execute, produce correct results, and meet all of the specifications in the weekly lab. Additionally, you must
  2. Organize the code for user readability.
  3. Organize the code for reusability.
  4. Provide documentation with embedded comments for reader understanding.
  5. Organize the code for efficiency.
    • 10 years ago
    • 30
    Answer(2)

    Purchase the answer to view it

    blurred-text
    NOT RATED

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      negativearray.zip