Question: (please do it using c programing) Extra Credit 1: how rich am I Read the entire assignment before you start designing your program or writing
(please do it using c programing)
Extra Credit 1: how rich am I
Read the entire assignment before you start designing your program or writing any code.
In the year 0 A.D., your ancestor deposited $1.00 in the Bank of Rome. (OK, it wasnt a real dollar; it was the Roman equivalent of a dollar. Probably some kind of big coin with a hole in the middle.) The bank promised to pay 5% interest compounded once a year.
In other words, they multiplied his balance by 1.05 once each year, so that
at the end of the year 1 A.D., the balance was $1.05.
at the end of the year 2 A.D., the balance was $1.1025 (which is 1.05 1.05).
at the end of the year 3 A.D., the balance was $1.157625 (which is 1.1025 1.05).
Since your ancestor was not around to withdraw it (Caesars descendants took care of that), the balance has accumulated nicely up to the present day. Because you are his rightful heir, the bank account is now yours. Bwa-ha-ha!!
Problem 1
Your first job is to write a C program that computes your current wealth: the balance of the account after 5% interest was compounded 2016 times.
Problem 2
In a coincidence that defies the odds, your friend's ancestor Portia Thomas also deposited money in the Bank of Rome in the year 0 A.D.
Back then, the Thomas family was much better off than your family, and Portia deposited $100,000.00. But Portia did not know that in business, you dont get what you deserve you get what you negotiate and she was able to get only a 4% interest rate on her deposit.
Your job is to write a C program that computes the first year in which your family's balance exceeds Portias balance, and prints out that year and the two balances in that year.
What to do and how to do it
By convention, when we intend a variables value to never change, we write the name of the variable in all uppercase. We call a variable that should never change a constant. For example, if you wanted to have a variable indicating Brutuss interest rate, you might define it with the code
double BRUTUS_INTEREST_RATE = 5;
(You dont have to use this exact name or this exact value. Im just providing it as an example of how we define variables.)
Now, C wont prevent you from changing the value of a variable whose name is in all uppercase. Its just a programming convention for the benefit of wetware (the stuff between your ears).
When you print out balances, they will be large. You will want to store them in floating point (double), and just let the floating point (double) values print normally. (Its fine if they print with scientific notation.) Your output should be nicely formatted. For example, if the current year were year 2 (not year 2016), the output of Problem 1 should read something like
At year 2, the balance is 1.1025.
Your output does not have to read exactly the same as mine, but it should read like an English sentence with spaces and punctuation in the right places. Remember that you can concatenate strings with the + operator, and you can convert a number to a string. And, of course, you should program your solution to Problem 1 to use the year 2016.
To compute the balances, use while-loops in which each iteration multiplies each balance by the appropriate factor. Do not use exponentiation to calculate balances. Start with the appropriate balances, and use loops to repeatedly multiply the balances by the appropriate amounts each time. Each iteration should correspond to one year.
Submit your HowRick.c for the two problems by define two methods, along with code in your main method that calls the methods and show the answer.
A helpful hint
I found it quite helpful, when developing my programs, to include a print statement within the body of the loop to show the year and the balances in each iteration of the loop. That way, I could verify that my program was doing the right thing. I then removed the print statement from my loop before declaring my program complete. Of course, I left in a print call after the loop, to print the answer. You should consider doing the same thing, but make sure to remove the print call within the loop bodyalternatively, you can leave it in but comment it outbefore submitting your program and its output.
What to turn in
HowRich.c
A screenshot to show the output of answering the first question.
A screenshot to show the output of answering the second question.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
