Using Java, answer the following What will be the O/P produced by the following
ID: 3809760 • Letter: U
Question
Using Java, answer the following
What will be the O/P produced by the following code, if you enter 10000 for input request of Enter balance amount: double INTEREST_RATE_1 = 0.01; //1% interest rate of a CD account (a type of saving account) double INTEREST_RATE_2 = 0.02; //2% interest rate of a CD account (a type of saving account) double deposit, interestAmt, yearEndBal; //deposit amount, annual interest amount & yearend balance amt System.out.print(Enter balance amount:); deposit = k.nextDouble(); yearEndBal = deposit; //initialize yearend balance with original deposit amt in case deposit =10000) { interestAmt = deposit * INTEREST_RATE_2; yearEndBal = deposit + interestAmt; } else { interestAmt = deposit * INTEREST_RATE_1; yearEndBal = deposit + interestAmt; } System.out.println(For deposit amount: +deposit + the interest rate will be: + INTEREST_RATE_2 + , and yearend balance will be: +yearEndBal); What will be the O/P produced by the following code? int n = -9; boolean ispositive = (n > 0); boolean isNegative = (nExplanation / Answer
Question 18:
Answer:
If we enter deposit amount as 10000 then if block will execute
So deposit value we are assigning to yearEndBal
now if block code will execute
interestAmt = 10000 * 0.02 = 200
yearEndBal = 10000 + 200
So it will print like
For deposit amount: 10000 the interest rate will be 0.02
, and yearend balance will be: 10200
Question 19
Answer:
n value is -9
so isPositive value is false becuase -9 value is not greater than 0
isNegative value is true becuase -9 value is less than 0
if consition will return false so else bolck will execute
Ans: Is negative
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.