Question: in C programming, The project is composed of two program files. Program 1: Write a program to create a sequential access data file account.txt .

in C programming,

The project is composed of two program files.

Program 1: Write a program to create a sequential access data file account.txt. This file stores the following account information: account number, last name, first name, user ID, and balance. Refer to fig11_02.c.

Requirements:

1. The data type for each field is given below. You can choose the data structure used for the program.

int acctNum;

char lastName[15];

char firstNamep10];

int userID;

double balance;

2. The interface and the user inputs are

Enter the Account, Last name, First name, user ID and balance.

Enter EOF to end input

? 29 Brown Nancy 101 -24.54

? 33 Dunn Stacey 102 314.33

? 37 Barker Doug 103 0.00

? 88 Smith Dave 104 258.34

? 96 Stone Sam 105 34.98

? ^Z

3. After execution of the program, open the file to verify the information has been correctly written.

Program 2: The program provides a menu for the user to select different tasks. You can refer to the fig11_06.c, fig11_07.c for the read and write. Refer to the fig11_15.c for the design of the main function.

Description:

Option 1: the program reads all the data from the data file account.txt created in program 1 and display them on the screen. Write a function listAll() to finish this task.

Option 2: Add a new account and save the account information in the data file account.txt. Write a function newRecord() to finish the task.

Option 3: search for an account and display the information of the account. Write a function searchRecord() to finish this task.

Option 4: exit the program

The interface of the program is

Enter your choice

1 list all account information

2 add a new account and write to the datafile

3 search for an account

4 end program

?

The sequence of the execution of the program is

Enter your choice

1 list all account information

2 add a new account and write to the datafile

3 search for an account

4 end program

? 1

Acct Last Name First Name User ID Balance

29 Brown Nancy 101 -24.54

33 Dunn Stacey 102 314.33

37 Barker Doug 103 0.00

88 Smith Dave 104 258.34

96 Stone Sam 105 34.98

? 2

Enter new account number (1-100): 55

Enter lastname, firstname, user ID, balance

? Johnston Sarah 106 247.45 (Note: after the execution of the command, open the data file to verify the new record has been correctly added)

? 3

Enter the account to query (1-100): 37

Acct Last Name First Name User ID Balance

37 Barker Doug 103 0.00

? 1

Acct Last Name First Name User ID Balance

29 Brown Nancy 101 -24.54

33 Dunn Stacey 102 314.33

37 Barker Doug 103 0.00

88 Smith Dave 104 258.34

96 Stone Sam 105 34.98

55 Johnston Sarah 106 247.45

? 4

Goodbye !

Requirements:

1. You can decide the input arguments for the functions listAll(), newRecord(), searchRecord().

2. Please following the user interface design specified in the project description, including sequence of the choice, the format of user input, etc.

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 Databases Questions!