Question: Use the following code to answer questions 24 and 25. public static void main(String[] args) { int i = 0; do { if (++i %

Use the following code to answer questions 24 and 25. public static void main(String[] args) { int i = 0; do { if (++i % 5 == 0) System.out.print(i + " "); } while (i < 20); }

24. How many times is the body of the loop repeated?

25. What is the exact output of the code?

26. For the following problem statement, would you include an if/else statement or a switch statement? Explain your answer. Be sure to address both types of statements in your answer. (You do not need to write the code.) Write a program that determines the bonus that should be paid to employees. Bonuses are derived as a percentage of the employee's salary, and the percentage is based on the department where the employee works. Employees in the sales department receive a bonus of 5%. Employees in the information technology department receive a bonus of 3%. All other employees receive a bonus of 2.5%.

27. Write a statement to declare a named constant called VERSION that has an String value of "1.1.57".

28. Can an enhanced for loop be used to initialize the all values of the array below to 100? Explain. int[] counter = new int[10];

29. Fill in the blank to specify that objects of a class named Purchase can be serialized. There may be more than one word in the blank. public class __________ {

30. What is the value assigned to answer? Show your work one operator at a time. int answer; answer = 6 * (3 + 5) % 7 + 5 / 2;

31. A salesperson earns a commission of 2% on sales up to $10,000, then earns a commission of 5% on any sales over $10,000. Write a sequence of statements to save the salesperson's commission to an integer value named commission, given his or her sales in an integer value named sales. (You may round all commission values down.)

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!