Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project(Pno, title, budget, deptno, rating) Department(Deptno, name, no_of_projects); Emp(empno, first_name, last_name, salary, gender, job_title) Write a function called count_by_gender that will accept a deptno
Project(Pno, title, budget, deptno, rating) Department(Deptno, name, no_of_projects); Emp(empno, first_name, last_name, salary, gender, job_title) Write a function called count_by_gender that will accept a deptno value and a gender value as parameters and return the total number of employees with the given gender in that department. The following conditions are to be treated as exceptions: Handle a relevant named exception by returning -11 If the gender parameter is not 'f' or 'm; return -12 (Hint: This is a user defined exception) Handle the socket exception ORA-08001 by returning -13 the public prival private Publ Question 5 (15 points) What will be the output of the given program? Briefly explain. ublic class Main ( public static void main(String[] args) { int a-2, b-4, c-0; int v[]; try( a+-b: b+-a; c - 10/(a-8); System.out.println("a"+a+" b="+b+" c="+c); v new int [a]: System.out.println("Array v is allocated."); v[a+b]-10; c += 20; System.out.println("Some values are updated"); System.out.println("Arithmetic exception handled."); } catch (ArithmeticException e) { a++; b += 2*a; System.out.println("Index out of bounds exception handled."); } catch (IndexOutOfBoundsException e) { b++; a - 2; 9 -- ; System.out.println("Runtime exception handled."); } catch (RuntimeException e) { c++; System.out.println("At the end a="+a+" b="+b+" c="+c);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started