Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that asks the user to input his saving account\'s balance, and t

ID: 643674 • Letter: W

Question

Write a program that asks the user to input his saving account's balance, and the program calculates the balance at the end of each year for three years. The program calculates a compound interest at the rate of 6.5% to be compounded at the end of each year. Show the results for three years in tabular columns with appropriate headings. Use a separate function to read the input, a function to compute the balance at the end of each year, and a function to display the results. I need the program to be written in C.

Note that:

to compute the new balance at the end of the year
New balance = Old balance * (1 + rate)

Interest = new balance

Explanation / Answer

#include <stdio.h>

double getAmount(){
   double amount;
   printf("Enter initial amount: ");
   scanf("%lf", &amount);
   return amount;
}

double getNewAmount(double amount){
   return amount + (amount * 0.065);
}

void display(double amount, double y1, double y2, double y3){
   printf("year old balance new balance interest ");
   printf("1 %.2lf %.2lf %.2lf ", amount, y1, y1 - amount);
   printf("2 %.2lf %.2lf %.2lf ", y1, y2, y2 - y1);
   printf("3 %.2lf %.2lf %.2lf ", y2, y3, y3 - y2);
}

int main(){
   double amount, y1, y2, y3;
   amount = getAmount();
   y1 = getNewAmount(amount);
   y2 = getNewAmount(y1);
   y3 = getNewAmount(y2);
   display(amount, y1, y2, y3);
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote