Question: Question 1: The following recursive function sums up the digits in a number: public static int sum(int n) { if (n < 10) return n;

Question 1: The following recursive function sums up the digits in a number: public static int sum(int n) { if (n < 10) return n; // { n has at least two digits } // return first digit + sum of rest return n%10 + sum(n/10); } How many iterations (e.g. function calls to sum) will it take to to compute the expression sum(12345)? Question 2: (True or False): Given the superclass Employee and subclass Executive, answer the question below. public class Employee {

public Employee(String, int) {...} public static double getCompensation() {...} public static void toString() {...} }

public class Executive extends Employee { public Executive(String, int, int) {...} public static double getCompensation() {...} public static double getBonus() {...} public static void toString() {...} }

Employee e = new Executive; double v = e.getBonus();

True or False: e.getBonus() is a valid operation.

Question 3:

Assume a class called Employee. Fill in the blank to initialize an array of 100 Employees: Hint: Do not include extra spaces, and make sure to include the terminal for end of statement.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!