Question: Using C programming, In the file 'CUSTOMER.DAT' there are 1 0 records with the following structure:In another file 'TRANSACTIONS.DAT' there are several records with the

Using C programming, In the file 'CUSTOMER.DAT' there are 10 records with the following structure:In another file 'TRANSACTIONS.DAT' there are several records with the following structure:struct trans{int accno; char trans_type ; float amount;};
The element trans_type contains D/W indicating deposit or withdrawal of amount. Write a program to update 'CUSTOMER.DAT' file, i.e., if the trans_type is 'D' then update the balance of 'CUSTOMER.DAT' by adding amount to balance for the corresponding accno. Similarly, if trans_type is 'W' then subtract the amount from balance. However, while subtracting the amount ensure that the amount should not get overdrawn, i.e., at least $100 should remain in the account. [Use the data as shown in following tables]
(Points: 50)
\table[[CUSTOMER.DAT],[Account#,Name,Balance in USD],[35007,Tim Cook,500],[35008,Daniel Brown,1600],[35009,CeCe Gilroy,220],[35010,Johny Mat,317],[35011,Drew Filmore,321],[35012,Natalie Day,190]]
1
CS 2060 Programming in C
Fall 2024
\table[[35013,Olivia Cobb,543],[35014,Mat Fullerton,270],[35015,Noel Ken,289],[35016,Chris Gill,965]]
\table[[TRANSACTIONS.DAT],[Account#,\table[[Transaction],[Type]],\table[[Amount in],[USD]]],[35007,D,20],[35008,W,13],[35009,D,25],[35010,D,79],[35011,W,43],[35012,D,63],[35013,W,22],[35014,W,231],[35015,W,56],[35016,D,12],[35007,D,33],[35008,W,43],[35009,D,32],[35010,W,12],[35011,W,12],[35012,W,43],[35013,D,76],[35014,D,78],[35015,W,9],[35016,D,76],[25007,w,77]]
\table[[TRANSACTIONS.DAT],[Account#,Transaction Type,Amount in USD],[35007,D,20],[35008,W,13],[35009,D,25],[35010,D,79],[35011,W,43],[35012,D,63],[35013,W,22],[35014,W,231],[35015,W,56],[35016,D,12],[35007,D,33],[35008,W,43],[35009,D,32],[35010,W,12],[35011,W,12],[35012,W,43],[35013,D,76],[35014,D,78],[35015,W,9],[35016,D,76],[35007,W,77],[35008,W,78],[35009,W,79],[35010,D,80],[35011,D,81],[35012,W,82],[35013,D,83],[35014,W,84],[35015,W,85],[35016,W,86]]
Using C programming, In the file 'CUSTOMER.DAT'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!