This is a debugging question - The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors,...


This is a debugging question -


The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. You also will use a file namedDebugEmployeeIDException.java with theDebugTwelve4.java file.


Code I was given-



public class DebugEmployeeIDException extends Exception

{

   public DebugEmployeeIDException()

   {

      super(s);

   }

}




// An employee ID can't be more than 999

// Keep executing until user enters four valid employee IDs

// This program throws a FixDebugEmployeeIDException

import java.util.*;

public class DebugTwelve4

{

   public static void main(String[] args)

   {

      Scanner input = new Scanner(System.in);

      String inStr, outString = "";

      final int MAX = 999;

      int[] emps = new int[4];

      for(x = 0; x <>

      {

        System.out.println("Enter employee ID number");

         inStr = input.next();

         throw

         {

            emps[x] = Integer.parseInt(inStr);

            if(emps[x] > MAX)

            {

               throw(new FixDebugEmployeeIDException("Number too high " + emp[x]));

            }

         }

         catch(NumberFormatException error)

         {

            --x;

            System.out.println(inStr + "\nNonnumeric ID");

         }

         catc(FixDebugEmployeeIDException error)

         {

        --x;

        System.out.println(");

         }

      }

      for(int x = 0; x <>

      {

         outString = outString + empss[x] + " ";

      }

      System.out.println("Four valid IDS are: " + outString);

   }

}





Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here