Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

IT 232 OCC Exception and Error Handling Questions

IT 232 OCC Exception and Error Handling Questions

IT 232 OCC Exception and Error Handling Questions

Description

Unit 6 Assignment: Exception and Error Handling

Outcomes addressed in this activity:

Unit Outcomes:

Differentiate between errors and exceptions.

Select appropriate methods for handling exceptions and errors.

Implement an Assert statement.

Implement a Try/Catch statement.

Course Outcome:

  • IT232-3: Select appropriate secure data handling techniques.
  • Purpose
  • The purpose of this assignment is to provide you with an opportunity to demonstrate knowledge of using exception handling tools such as assert statements and try/catch blocks.
  • Assignment Instructions

You will complete a single program containing multiple sections to demonstrate the skills presented in this lesson for your chosen language path. Please keep in mind that with all the assignments in this course, any given scenarios are hypothetical and intended solely to demonstrate specific skills. The source code file is the file in your project that contains the code you wrote. You will only need to submit the source code file for your program and not the entire project folder or any additional project files. Below are listed the file extensions for the source code file for each language:

.cs file for C#

.java file for Java

.php and .js files for Web Development

Note: If your language of choice is Web Development, you will need to complete the exercises in both PHP and JavaScript.

Using the language in which you have chosen to focus: C#, Java, Web Development languages (PHP and JavaScript), please complete the following Assignment:

The program for this assignment will consist of four sections, each headed by the three-line comment below:

//*********************************************************

//****Assignment 6 Section X

//*********************************************************

(where X stands for the portion of the assignment to follow.)

Assignment Requirements

Section 1:

Enter the comment with the section title as described above.

Print to the console the message, ssignment 6 sserts and Try/Catch./p>

Create a string variable and set its value to null or empty.

Create an integer variable and set it to 0.

Note: The variables above are initialized to values intended to trigger the following assert statements.

Create an assert statement to validate that the string variable is not empty or null with the message, !rameter must not be empty or null./p>

Create an assert statement to validate that the integer variable is greater than zero with the message, !rameter must be greater than zero./p>

Section 2:

Enter the comment with the section title as described above.

You will create an array of strings.

You will create a try/catch block.

In the try portion of the try/catch, you will loop through the array using a ¯r loop7here your index variable begins at 0 and the loop continues as long as the index is <=the length of the array. This will cause an array out of bounds error where the loop attempts to access an array index value that is one more than the last item.

  1. The catch portion will catch the out of bounds exception. Inside the catch block you will write two lines to the console. The first simply prints the string, rray out of bounds error occurred. n a new line you will then print the error message contained in the exception object.
  2. Section 3:
  3. Enter the comment with the section title as described above.
  4. You will create a try/catch block.

In the try portion of the try/catch, you will attempt to open a non-existent file named, ¯FileNamedThis.txt¼/p>

The catch portion will catch the file not found exception. Inside the catch block you will write two lines to the console. The first simply prints the string, ©le not found error. n a new line you will then print the error message contained in the exception object.

Section 4:

  1. Enter the comment with the section title as described above.
  2. You will create a function called, )videByZero which will allow for two integer operands, dividend and divisor. 

The function will check to be sure the divisor is not equal to zero.

If the divisor is equal to 0 then the function will throw an exception with the message, )vide by Zero./p>

You will create a try/catch block.

  1. In the try portion you will call the function, DivideByZero, and pass it two numbers with the second being 0 to cause an error.
  2. The catch portion will catch the Divide By Zero exception thrown by the function. Inside the catch block you will write two lines to the console. The first simply prints the string, )videByZero error occurred. n a new line you will then print the error message contained in the exception object.
  3. EXPECTED OUTPUT
  4. Note: Error messages might differ from language to language and the file path as well.
  5. Assignment 6 sserts and Try/Catch.

(Here the two assert statements should create popup windows informing the user the string is null or empty and the integer should be greater than 0. Choosing to ignore the assertions should allow the program to continue.)

ArrayOutOfBounds error occurred
Index was outside the bounds of the array.

FileDoesNotExist error occurred
Could not find file
ú NoFileNamedThis.txt/p>

  1. DivideByZero error occurred
    Divide By Zero
User generated content is uploaded by users for the purposes of learning and should be used following our’s honor code & terms of service.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Essay Noon only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Essay Noon are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Essay Noon are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Essay Noon, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20