Question: QUESTION 12 Use the following code to answer questions 12 and 13. public static void main(String[] args) { int i = 10; do { System.out.print(i--);

QUESTION 12

Use the following code to answer questions 12 and 13.

public static void main(String[] args) { int i = 10; do { System.out.print(i--); System.out.println("..."); } while (i == 1);}

How many times is the body of the loop repeated?

Show the exact output of the code in the box below.

6 points

QUESTION 14

For the following problem statement, would you use 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 determined based on the years production. The bonus is $25 for 1000 units or fewer. The bonus is $50 for 1001 to 3000 units. The bonus is $100 for 3001 units or more.

3 points

QUESTION 15

Write a statement to declare a constant called maximum that has an integer value of 100.

2 points

QUESTION 16

What is the value assigned to answer? Show your work one operator at a time.

int answer; answer = 6 (2 * 2) + 5 % 2 * 6 / 2;

QUESTION 17

A salesperson earns a bonus of 1% of their sales if they made at least $100,000 in sales but less than $1,000,000 of sales. The salesperson earns a bonus of 2% if he or she makes $1,000,000 or more in sales. No bonus is earned if the salesperson made less than $100,000 in sales. Assuming an integer value named sales contains the amount of sales in dollars, write an if/else statement that sets the appropriate bonus value in a variable named bonus. Assume the bonus variable can store decimal places, and ignore rounding to the nearest cent.

QUESTION 18

Write a single line of Java code to create an object called account from the CheckingAccount class. Assume the class has a default constructor.

QUESTION 19

Assume x is 0. What is the output of the following statement?

if (x >= 0) System.out.print("orange"); else if (x <= 0) System.out.print("purple"); else System.out.print("gray");

QUESTION 20

What is the value of j after the following code has executed?

int i = 1; int j = 1; while (i < 5) { i++; j = j * 2; }

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!