Sample Test CasesTest Case 1:Expected Output:1,2,3,4,55list·index·out·of·rangeError·HandledTest Case 2:Expected Output:3,2,2,-2,-53-2division·by·zeroError·HandledTest Case 3:Expected Output:12,34,-56,34,-67,78,-4567,-5433,345678345670.00Error·Handled
Question
Sample Test CasesTest Case 1:Expected Output:1,2,3,4,55list·index·out·of·rangeError·HandledTest Case 2:Expected Output:3,2,2,-2,-53-2division·by·zeroError·HandledTest Case 3:Expected Output:12,34,-56,34,-67,78,-4567,-5433,345678345670.00Error·Handled
Solution
I'm sorry, but your question seems to be incomplete. Could you please provide more details or clarify what you need help with?
Similar Questions
Execution Results 0 out of 3 shown cases successful0 out of 3 hidden cases successfulShow only failed cases Test Case - 1 (Execution Time: 1 ms) Expected Output User Output5 52 2 1 3 2 2 2 1 3 24 42 22 Empty : indicates the mismatch in the expected output. Test Case - 2 (Execution Time: 1 ms) Expected Output User Output5 52 2 2 2 2 2 2 2 2 24 43 30 Empty : indicates the mismatch in the expected output. Test Case - 3 (Execution Time: 2 ms) Expected Output User Output1 12 22 21 11 Empty : indicates the mismatch in the expected output.
Test Case - 1 (Execution Time: 176 ms) Expected Output User OutputEnter·the·value·of·'a':·1Enter·the·value·of·'a':·1Enter·the·value·of·'b':·0 ↥0Arithmetic·Exception:·/·by·zero Enter·the·value·of·'b':·Extra outputArithmaticExeception:/ by zero : indicates the mismatch in the expected output. Test Case - 2 (Execution Time: 194 ms) Expected Output User OutputEnter·the·value·of·'a':·sEnter·the·value·of·'a':·sInput·Mismatch·Exception:·Please·enter·valid·integer·values. ↥ : indicates the mismatch in the expected output. Test Case - 3 (Execution Time: 228 ms) Expected Output User OutputEnter·the·value·of·'a':·50Enter·the·value·of·'a':·50Enter·the·value·of·'b':·4 ↥4Result·of·a/b:·12 Enter·the·value·of·'b':·Extra outputResult of a/b:
2/2 - Sample Test Cases FailedDefault Test Case 1CODE EXECUTION DETAILSTime: 136 msMemory: 103812 kbTEST CASE INFORMATIONInput60004Expected Output4Actual Output13
Note: Refer to the visible test cases for more clarity.Constraint:0≤𝑎≤1020≤𝑏≤102Input Format: The input consists of two numbers each in a new line (integer).Output Format: The output represents the result of the division of the two numbers or any error that occurred while dividing.Sample Test CasesTest Case 1:Expected Output:Enter·the·value·of·'a':·1Enter·the·value·of·'b':·0Arithmetic·Exception:·/·by·zeroTest Case 2:Expected Output:Enter·the·value·of·'a':·sInput·Mismatch·Exception:·Please·enter·valid·integer·values.Test Case 3:Expected Output:Enter·the·value·of·'a':·50Enter·the·value·of·'b':·4Result·of·a/b:·12Submit1234567891011121314151617181920212223242526272829303132import·java.util.InputMismatchException;¬import·java.util.Scanner;¬¬public·class·ExceptionHandlingExample·{¬————public·static·void·main(String[]·args)·{¬········Scanner·scanner=new·Scanner(System.in);¬········¬········try·{¬········————System.out.println("Enter·the·value·of·'a':·");¬········————int·a·=·scanner.nextInt();¬········————¬········————System.out.println("Enter·the·value·of·'b':·");¬········————int·b·=·scanner.nextInt();¬········————¬········————int·result=·divide(a,·b);¬········————System.out.println("Result·of·a/b:·"+result);¬········}·catch·(·ArithmeticException·e·)·{¬········¬········————System.out.println("ArithmaticExeception:/·by·zero");¬········}·catch·(InputMismatchException·e··)·{¬········————¬········————System.out.println("Input·Mismatch·Exception:·Please·enter·valid·integer·value.");¬········}¬¬····}¬¬····public·static·int·divide(·int·a,·int·b·)·{¬····————return·a/b;¬····————¬····}¬}¬¶Execution Results 0 out of 3 shown cases successful0 out of 4 hidden cases successfulShow only failed cases Test Case - 1 (Execution Time: 180 ms) Expected Output User OutputEnter·the·value·of·'a':·1Enter·the·value·of·'a':·1Enter·the·value·of·'b':·0 ↥0Arithmetic·Exception:·/·by·zero Enter·the·value·of·'b':·Extra outputArithmaticExeception:/ by zero : indicates the mismatch in the expected output. Test Case - 2 (Execution Time: 180 ms) Expected Output User OutputEnter·the·value·of·'a':·sEnter·the·value·of·'a':·sInput·Mismatch·Exception:·Please·enter·valid·integer·values. ↥ : indicates the mismatch in the expected output. Test Case - 3 (Execution Time: 197 ms) Expected Output User OutputEnter·the·value·of·'a':·50Enter·the·value·of·'a':·50Enter·the·value·of·'b':·4 ↥4Result·of·a/b:·12 Enter·the·value·of·'b':·Extra outputResult of a/b: 12
Execution Results 0 out of 3 shown cases successful 0 out of 2 hidden cases successful Show only failed cases Test Case - 1 (Execution Time: 22 ms) Expected Output User Output Enter·number·of·rows·:·5 Enter·number·of·rows·:·5 ····1· ·····1· ···2·3· ·····2· ··4·5·6· ····3· ·7·8·9·10· ···4· 11·12·13·14·15· ··5· Extra output : indicates the mismatch in the expected output. Test Case - 2 (Execution Time: 23 ms)
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.