Question 1
Using exceptions, write a Java application CheckValue with the following specification: The application defines an integer variable taking legal values within the range -9 .. 9 inclusively and invites the user to enter a value for this variable. If the user enters a legal value, it will be assigned to the variable, the message “Initialization completed” will be displayed and the program execution terminates. If an illegal value is entered, it will be identified and reported by displaying an appropriate message at the console and the user will be invited to re-enter a legal value. The following situations should be identified and reported: s1 - the user has entered an integer number outside the specified range (such as 10); s2 - the user has entered a non-integer number (such as 15.43) and s3 - the user fails to enter a number (such as nine). Be sure your code compiles and runs as expected.

Question 2
Consider a Java interface WarehouseProcessing consisting of the following abstract methods suitable for the management of a warehouse of different products: addToExistingStock, deliverFromExistingStock and isEmptyStock.
(a) Design the interface methods by considering and discussing their arguments and return type. Consider that each product in the warehouse is identified by a unique id.(b) Write the Java code for the interface WarehouseProcessing. Be sure your code compiles without errors.

1. Java source files and .
2. A document file containing the following elements: (1) Short questions discussion / analysis, (2) Design decisions and assumptions, (3) Relevant test cases and two relevant screenshots for the CheckValue program, (4) Error handling, (5) Lessons learned and (6) Possible improvements.

Other questions:
1. Discuss the differences between the checked and unchecked exceptions and how they should be handled in Java.
2. Give examples of checked and unchecked exceptions and discuss the circumstances when they might occur.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class CheckValue {

    * checking an integer variable whether it takes
    * legal values within the range -9 .. 9
    * @param integer
    * @throws Exception
    public static void checkRange (int integer) throws Exception {
         if (integer < -9 || integer > 9) {
             throw new Exception("the user has entered an integer number outside the specified range ");
    * checking whether input is a valid number
    * @param number
    * @throws Exception
    public static void checkNumber(String number) throws Exception {
       try {
       } catch (Exception e) {
            throw new Exception("the user fails to enter a number");
$30.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats