Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BANKING SYSTEM PROGRAM* Create a function in C LANGUAGE (not C++) which will assign a random account number of 6 digit, random name, random mobile

BANKING SYSTEM PROGRAM* Create a function in C LANGUAGE (not C++) which will assign a random account number of 6 digit, random name, random mobile number, random street and random city address, as well as random balance. Basically instead of asking the details of customer, the random function will create random details. But account ID is not random, the account ID will be in ascending order starting with 1 and going up to total number of customer. Because we search customer from his account ID. In simple words, when we run this random function for 100 customer, the first customer should have account ID 1 and last should have 100. So it is pretty ordered.

void print_all() { FILE *fp=fopen("customer_data.bin","rb"); printf("ID | ACCOUNT NO. | NAME | MOBILE NO. | STREET | CITY | BALANCE | ACTIVE? "); while( fread(&customer, sizeof(customer), 1, fp) == 1 ) { printf("%d | ", customer.number); printf("%d | ", customer.acct_no); printf("%s | ", customer.name); printf("%d | ", customer.mobile_no); printf("%s | ", customer.street); printf("%s | ", customer.city); printf("%.2f | ", customer.balance); check_account_status(customer.number); printf(" "); } fclose(fp); int m; do { printf(" ================================ "); printf("Press 1 to come back to main menu "); scanf("%d", &m); } while(m!=1); }

void input() { FILE *fp=fopen("customer_data.bin","rb"); int highest_id = 0; while( fread(&customer, sizeof(customer), 1, fp) == 1 ) { highest_id = customer.number; } fclose(fp); customer.number=highest_id+1; printf(" Customer ID:%d ", customer.number); printf(" Account number:"); scanf("%d",&customer.acct_no); printf(" Name:"); scanf("%s",customer.name); printf(" Mobile number:"); scanf("%d",&customer.mobile_no); printf(" Street:"); scanf("%s",customer.street); printf(" City:"); scanf("%s",customer.city); printf(" Balance:"); scanf("%f",&customer.balance); printf(" "); return; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago