Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Module 13 Lab: Exception Handling Lab Objective The objective of this assignment is to teach the student how to define and use their own exception

image text in transcribed

Module 13 Lab: Exception Handling Lab Objective The objective of this assignment is to teach the student how to define and use their own exception handler for testing if a user entered a number out of range. Lab Instructions Create a Java Application using Netbeans, called HundredTest. This Java Application will test numeric integers to determine if they are less than 100. Download the Java Application template, HundredTest.java, from Canvas under Module 13: Lab. Copy and Paste the source code into your newly created Java Application. This application utilizes a lessThan100 method to test whether the number provided is less than 100. Program the static lessThan100 method which accepts an integer number as an argument and returns a formatted String indicating that the number was successfully less than 100 (if it was). If the number is greater than 100, the method should throw an Exception indicating that the number is too large. Additional Information Create a local Static method called 'lessThan100(), which accepts an integer parameter. If the number passed to the method is less than 100, the method should output a string "The number %d is less than 100" If the number passed to the method is not less than 100, the method should throw an Exception, with the text "Number too large Test Harness The HundredTest template includes a test harness which will call you method with different numbers. If the number is less than 100, the output string will be displayed. If the number is 100 or more, an error string will be displayed. Use this harness to test your implementation. Output Information The number 1 is less than 100 The number 22 is less than 100 java.lang.Exception: Number too large Module 13 Lab: Exception Handling Lab Objective The objective of this assignment is to teach the student how to define and use their own exception handler for testing if a user entered a number out of range. Lab Instructions Create a Java Application using Netbeans, called HundredTest. This Java Application will test numeric integers to determine if they are less than 100. Download the Java Application template, HundredTest.java, from Canvas under Module 13: Lab. Copy and Paste the source code into your newly created Java Application. This application utilizes a lessThan100 method to test whether the number provided is less than 100. Program the static lessThan100 method which accepts an integer number as an argument and returns a formatted String indicating that the number was successfully less than 100 (if it was). If the number is greater than 100, the method should throw an Exception indicating that the number is too large. Additional Information Create a local Static method called 'lessThan100(), which accepts an integer parameter. If the number passed to the method is less than 100, the method should output a string "The number %d is less than 100" If the number passed to the method is not less than 100, the method should throw an Exception, with the text "Number too large Test Harness The HundredTest template includes a test harness which will call you method with different numbers. If the number is less than 100, the output string will be displayed. If the number is 100 or more, an error string will be displayed. Use this harness to test your implementation. Output Information The number 1 is less than 100 The number 22 is less than 100 java.lang.Exception: Number too large

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions