Using only the sequential operations described in Section 2.2.2, write an algori
ID: 3674139 • Letter: U
Question
Using only the sequential operations described in Section 2.2.2, write an algorithm that gets values for the starting account balance B, annual interest rate I, and annual service charge S. Your algorithm should output the amount of interest earned during the year and the fi nal account balance at the end of the year. Assume that interest is compounded monthly and the service charge is deducted once, at the end of the year. Algorithm: Number the steps and be sure to include all required inputs and outputs. Step 1: Get values for B, I, and S Step 2: Set the value of FinalBalance to (1 + I/12)12B Step 3: Set the value of Interest to FinalBalance – B Step 4: Set the value of FinalBalance to FinalBalance – S Step 5: Print the message “Interest Earned:” Step 6: Print the value of Interest Step 7: Print the message “Final Balance” Step 8: Print the value of FinalBalance
This is my question:
.Modify the algorithm of Exercise 2 to include the annual service charge only if the starting account balance at the beginning of the year is less than $1,000. If it is greater than or equal to $1,000, then there is no annual service charge.
Explanation / Answer
1.) Input values for B, I, and S
2.) Set the value of FinalBalance to B * (1 + I/12)12
3.) Set the value of TotalInterest to FinalBalance – B
4.) Set the value of FinalBalance to FinalBalance – S
5.) Print the message “Total Interest Earned: “, and print the value of TotalInterest
6.) Print the message “Final Balance: “, and print the value of FinalBalance
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.