Question 38 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question 38 of 76 from exam 1Z0-808: Java SE 8 Programmer I

Question

Given the code fragment:

public static void main(string[] args) {
double discount = 0;
int qty = Integer. parseInt (args[0]);
féline x:

And given the requirements: -> If the value of the qty variable is greater than or equal to 90, discount = 0.5 -> If the value of the qty variable is between 80 and 90, discount = 0.2 Which two code fragments can be independently placed at line n1 to meet the requirements?

oa)

OB)

oc)
oD)

ENE).

{

ao.

2

a.

if (qty >= 90) { discount
if (qty > 80 g& qty < 90)
discount = (qty >= 90) ?
discount = (qty > 80) 2 0.
discount = (qty >= 90) ?
if (qty > 80 6& qty < 90)
discount = 0.2;
} else {
discount = 0;
3
if (qty >= 90) (
discount = 0.5;
} else {
discount =
}
discount = (qty > 80) 2 0.

{

2

5

5

0.5; }
discount = 0.2; 3}
a;
a;
(qty > 80)? 0.2

(qty >= 90) 200.

5

Oo;

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

AC.