Question

Write a C program that allows the user to balance a credit card account. The program...

Write a C program that allows the user to balance a credit card account. The program should first prompt the user to enter the Bank Name, and the beginning balance of his/her credit card account (must allow for dollars and cents). The program should then prompt the user to enter the number of refunds to be posted, and then the number of payments to be posted, and then the number of charges to be posted. For this assignment, let's set a maximum of 30 transactions of any of those types, you'll see why as you read on.

Using a loop, the program should then prompt the user to enter the amount of the first refund (a positive amount to add to the credit card account balance), the amount of the second, the third, & etc., until the number of refunds are processed.

Using a second loop, the program should then prompt the user to enter the amount of the first payment (a positive amount to add to the credit card account balance), then amount of the second, the third, etc. until the number of payments have been processed.

Using a third loop, the program should then prompt the user to enter the amount of the first charge (a positive amount to be subtracted from the credit card account balance), then amount of the second, the third, etc. until the number of charges have been processed. Once all charges and refunds and payments have been made, the program should output the Reconciliation report.

Read all the specifications carefully. I did not show all the editing features you are required to do, but they are in bold above.

The dialog with the user should look exactly as the following, only with your special introductory statement as you wish:

Welcome to the Sears Credit Card Accounting System

First, enter the name of the Bank: First Federal

Now enter the First Federal Credit Card balance in dollars and cents: -200.33

Enter the number of refunds to post: 44

Error: Number of refunds must be at most 30, please re-enter.

Enter the number of refunds to post: 2

Enter the number of payments to post: 1

Enter the number of charges to post: 4

Enter the amount of refund #1: 12

Enter the amount of refund #2: 13.22

Enter the amount of payment #1: -33.00

Error: Payment amount must be greater than zero, please re-enter.

Enter the amount of payment #1: 33.00

Enter the amount of charge #1: 111

Enter the amount of charge #2: 272

Enter the amount of charge #3: 11.55

Enter the amount of charge #4: 27.45

First Federal Reconciliation Report

---------------------------------------------

Starting Balance: $ -200.33

refund # 1: 12.00

refund # 2: 13.22

payment # 1: 33.00

charge # 1: 111.00

charge # 2: 272.00

charge # 3: 11.55

charge # 4: 27.45

Ending Balance: $ -564.11

There must be data validation on all user numeric input, and proper trap loops need to be used. These are discussed in the notes and examples are there as well as in the chats. It is hard to see in this document, but I want you to align the decimal points in the account reconciliation summary report. You are to keep track of all the refunds, payments and charges so that you can print them out in reconciliation form. You do this by storing them in arrays. You want to be sure that the size of the arrays are large enough to handle 30 of each transaction. Perhaps: float refunds[30], charges[30], payments[30];

Homework Answers

Answer #1

Dear Student here is your required code.

Code

__________________________________________________________________________

#include<stdio.h>

int main(){
   float refunds[30],charges[30],payments[30];
   float balance;
   int nref,npay,ncha,i=0,j=0,k=0,x=0;
   char name[100];
   printf("Welcome to the Sears Credit Card Accounting System\n");
   printf("First,enter the name of the bank: ");
   scanf("%[^\n]%*c", name);
   printf("Now enter the ");
   printf("%s",name);
   printf(" Credit Card balance in dollars and cents: ");
   scanf("%f",&balance);
   printf("Enter the number of refunds to post: ");
   scanf("%d",&nref);
   while(nref>30){
   printf("Error: Number of refunds must be at most 30, please re-enter.\nEnter the number of refunds to post: ");
   scanf("%d",&nref);
   }
   printf("Enter the number of payments to post: ");
   scanf("%d", &npay);
   printf("Enter the number of charges to post: ");
   scanf("%d", &ncha);

   for( i=1;i<=nref;i++){
       printf("%s %d %s","Enter the amount of refund #",i,": ");
       scanf("%f",&refunds[i]);
       while(refunds[i]<0){
       printf("\nError:refund amount must be greater than zero, please re-enter.");
       scanf("%f",&refunds[i]);
       }
   }
   for( j=1;j<=npay;j++){
       printf("%s %d %s","Enter the amount of payment #",j,": ");
       scanf("%f",&payments[j]);
       while(payments[j]<0){
       printf("Error:payment amount must be greater than zero, please re-enter.");
       scanf("%f",&payments[j]);
       }
   }
   for( k=1;k<=ncha;k++){
       printf("%s %d %s","Enter the amount of charge #",k,": ");
       scanf("%f",&charges[k]);
       while(charges[k]<0){
       printf("\nError:charge amount must be greater than zero, please re-enter.");
       scanf("%f",&charges[k]);
       }
   }  
   printf("%s %s",name,"Reconciliation Report\n---------------------------------------------");
   printf("%s %.2f","\nStarting balance:$ ",balance);
   for(x=1;x<=nref;x++){
       printf("%s %d %s %.2f","\nrefund # ",x,": ",refunds[x]);
       balance+=refunds[x];
   }
   for(x=1;x<=npay;x++){
       printf("%s %d %s %.2f","\npayment # ",x,": ",payments[x]);
       balance+=payments[x];
           }
   for(x=1;x<=ncha;x++){
       printf("%s %d %s %.2f","\ncharge # ",x,": ",charges[x]);
       balance-=charges[x];
   }
   printf("%s %.2f","\nEnding Balance:$ ",balance);
      
}

__________________________________________________________________________

Here is sample output

If it helps then please rate my answer and for further clarification put a comment.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user...
Write most basic C++ program possible that calculates monthly savings account balance. Program will prompt user to enter initial account balance, annual percentage rate, amount deposited each month, and total number of months. Validate user inputs allowing only positive numbers. B = initial account balance A = amount deposited each month R = annual percentage rate Total Balance = (R/12+1)B+A
In John​ Balfour's credit card account interest is charged on the average daily balance. The cycle...
In John​ Balfour's credit card account interest is charged on the average daily balance. The cycle begins on May​ 4, and the cycle ends on June 3. The beginning balance is $ 287.54 . A payment of ​$200 is posted on May 18. A charge of ​$17.86 is posted on May 7. A charge of ​$55.81 is posted on May 12. A charge of ​$116.42 is posted on May 29. John is charged 1.46​% per period. What is the finance...
You have a credit card with an APR of 20%. You begin with a balance of...
You have a credit card with an APR of 20%. You begin with a balance of $750. In the first month you make a payment of $550 and you make charges amounting to $400. In the second month you make a payment of $400 and you make new charges of $550. Complete the following table. (Round your answers to the nearest cent.) Previous balance Payments Purchases Finance charge New balance Month 1 $750 $ $ $ $ Month 2 $...
You have a credit card with an APR of 12%. You begin with a balance of...
You have a credit card with an APR of 12%. You begin with a balance of $300, in response to which you make a payment of $75. The first month you make charges amounting to $65. You make a payment of $75 to reduce the new balance, and the second month you charge $75. Complete the following table. (Round your answers to the nearest cent.) Previous balance Payments Purchases Finance charge New balance Month 1 $300.00 $ $ $ $...
You have a credit card with an APR of 12%. You begin with a balance of...
You have a credit card with an APR of 12%. You begin with a balance of $200, in response to which you make a payment of $100. The first month you make charges amounting to $50. You make a payment of $100 to reduce the new balance, and the second month you charge $55. Complete the following table. (Round your answers to the nearest cent.) Previous balance Payments Purchases Finance charge New balance Month 1 $200.00 $ $ $ $...
You had recently received your credit card statement and wish to be sure the finance charge...
You had recently received your credit card statement and wish to be sure the finance charge for the billing cycle is correct. The statement indicated a beginning balance of $600. On day 5 a charge of $150 had posted to the account, on day 12 a charge of $300 posted to the account. On day 15 you had made a payment of $200. Use the below table to calculate the average daily balance and the finance charge, assuming the interest...
Use the average daily balance method to compute the finance charge on the credit card account...
Use the average daily balance method to compute the finance charge on the credit card account for the previous month. The starting balance and transactions on the account for the month of April are given to the right. Assume an annual interest rate of​ 18%. Month: April (30 days); previous month's balance: $480 April 11 Charged $70 for a coat April 17 Made payment of $120 April 20 Charged $138 for DVDs April 29 Charged $38 for groceries
Use the unpaid balance method to find the finance charge on the credit card account. Last?...
Use the unpaid balance method to find the finance charge on the credit card account. Last? month's balance, the? payment, the annual interest? rate, and any other transactions are given. Last? month's balance, ?$410 ?Payment, ?$260 Interest? rate, 18.1?% Bought plane? ticket, ?$100 Bought? luggage, ?$120 Paid hotel? bill, ?$185 The finance charge is ?$ ?(Round to the nearest cent as? needed.)
1. After reconciling a credit card account, A. a bill for the statement balance must be...
1. After reconciling a credit card account, A. a bill for the statement balance must be recorded. B. full or partial payment of the statement balance must be recorded. C. a check for full or partial payment of the balance can be recorded, a bill for the statement balance can be recorded, or the credit card balance can be left in the credit card liability account. D. the payment of the statement balance or a bill for the statement balance...
Using the unpaid balance​ method, find the current​ month's finance charge on a credit card account...
Using the unpaid balance​ method, find the current​ month's finance charge on a credit card account having the following transactions?    Last​ month's balance: ​$650    Last​ payment: ​$220    Annual Interest​ rate: 21​%   ​ Purchases:  ​$594   ​ Returns: ​$698