Examlex

Solved

Rewrite the Following Nested If-Else Statements Using an Equivalent Switch

question 25

Essay

Rewrite the following nested if-else statements using an equivalent switch statement.
if (letter == 'A' || letter == 'a')
System.out.println("Excellent");
else if (letter == 'B' || letter == 'b')
System.out.println("You can do better");
else if (letter == 'C' || letter == 'c')
System.out.println("Try harder");
else if (letter == 'D' || letter == 'd')
System.out.println("Try much harder");
else System.out.println("Try another major! ");


Definitions:

Required Return

The minimum return that an investor expects to achieve by investing in a particular asset, taking into account the asset's risk.

Straight-Line Depreciation

A method of allocating the cost of a tangible asset over its useful life in an equal annual amount.

Net Working Capital

The difference between a company's current assets and current liabilities.

Variable Costs

Expenses that change in proportion to the activity of a business such as costs for raw material which increase as production increases.

Related Questions