The owner of a small business maintains a saving account where the interest is c
ID: 3575461 • Letter: T
Question
The owner of a small business maintains a saving account where the interest is compounded daily at the rate of 7.25% per annum He withdraws S300 on every Friday to pay his business expenses. The following table gives the record of his deposits. Write a simple Ansi-C program which reads in his deposits using single dimensional arrays and prepare a daily statement of his account. Your print out should indicate the day of the week, the date, the deposits, withdrawals made on that day, the interest accrued on that day and the current balance at end of the day. (you may assume that the account starts on the first day of the month which happens to be a MONDAY) 8 9 10 Date 12 Deposits (in 800 140 110 90 180 90 70 40 120 200 Date 15 16 17 18 19 22 23 24 25 26 Deposits (in S) 80 90 110 130 170 100 60 500 120 190 29 30 31 Date Deposits (in SO 120 100 180 "Daily interest is given to the account at the end of every day. Draw the flow chart.Explanation / Answer
Answer
The required code is as below:
#include<stdio.h>
int main()
{
int dep[31] = {80, 140, 110, 90, 180, 90, 70, 40, 120, 200, 0, 0, 80, 90, 110, 130, 170, 100, 60, 50, 120, 190, 0, 0, 120, 100, 180};
int i;
int date=0;
float interest;
int balance=0;
printf("Enter the date of withdrawal(just the day number)::");
scanf("%d", &date);
switch(date % 7)
{
case 0: printf("Day of the week is SUNDAY ");
break;
case 1: printf("Day of the week is MONDAY ");
break;
case 2: printf("Day of the week is TUESDAY ");
break;
case 3: printf("Day of the week is WEDNESDAY ");
break;
case 4: printf("Day of the week is THURSDAY ");
break;
case 5: printf("Day of the week is FRIDAY ");
break;
case 6: printf("Day of the week is SATURDAY ");
break;
}
printf("Date is %d of the month ",date);
printf("Deposit made on %d of the month is %d ", date, dep[date-1]);
if(date % 7 == 5)
printf("Withdrawal made is $300 ");
else
printf("There was no withdrawal made today. ");
interest = (dep[date-1] * 7.25 * 1)/(100*365);
printf("Interest accrued on %d is %.2f ", date, interest);
for(i=0;i<date;i++)
{
balance = balance + dep[i];
}
printf("Balance at the end of %d is %d ", date, balance);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.