PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert?

You create Microsoft Windows-based applications. You create a banking application that will be used by the account managers of the bank.

You identify a method to simulate the deposit functionality of a savings account. The method will calculate the final balance when monthly deposit, number of months, and quarterly rate are given. The application requirements state that the following criteria must be used to calculate the balance amount:

Apply the quarterly interest rate to the balance amount of the account every three months. Apply the quarterly interest rate before the monthly deposit is calculated for the third month.

You translate the outlined specification into pseudo code. You write the following lines of code. (Line
numbers are included for reference only.)

Method
public static decimal SimulateSavings

Input parameters

int months
decimal monthlyPayment
decimal quarterlyRate

Pseudo code

01 Declare balance variable, initialize it to zero
03 Return balance

You need to insert the appropriate code in line 02. Which code segment should you insert?

PrepAway - Latest Free Exam Questions & Answers

A.
01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 3 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance

B.
01 Declare integer variable, x02 For x=1 to months/32.1 balance = balance + 2 * monthlyPayment2.2 balance = (1 + quarterlyRate) * balance2.3 balance = balance + monthlyPayment

C.
01 Declare integer variable, x02 For x=1 to months2.1 balance = balance + monthlyPayment2.2 if x mod 3 is 0 then balance = (1 + quarterlyRate) * balance

D.
01 Declare integer variable, x02 For x=1 to months2.1 if x mod 3 is 0 then balance = (1 + quarterlyRate) * balance2.2 balance = balance + monthlyPayment


Leave a Reply