Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a menu driven program that is capable of performing the following operations: 1- Create a random-access file 2- Display a random-access file 3- Retrieve

Write a menu driven program that is capable of performing the following operations: 1- Create a random-access file 2- Display a random-access file 3- Retrieve a record 4- Modify a record 5- Add a new record 6- Delete a record 7- Exit

The random access file will contain student's academic records having the format below: First name 40 Last name 40 Student ID 4 GPA 8

where the integers represent the field width in terms of the number of bytes. The students first and last names are at most 20 characters (Unicode characters) long, the ID is an integer, and the GPA is of type double. There are actually two files in this project, a text file and a random access file. You will create a text file containing information for, at least, 10 students (one line per student), and this program will read that information and store it into a random access file. 1- Create a random-access file: It asks the user to enter an input file name (a text file) and an output file name (a random access file). If the output file already exists, it deletes the file first and then creates a new one. The program reads the student's first name, last name, ID, and GPA from the input file, creates a fixed size record as shown above in the memory, and then writes this record to the random access file. It does this as long as the input file is not empty. 2- Display the random-access file: It asks the user to type in a file name. The program neatly displays all the records stored in the file on the screen except those that are marked as deleted It should display as many records as will fit on a single screen (say 5 records), and then prompt the user with the following: Return to the main menu (M); Next screen (N); or Display all (A). The display all option should only print the remaining records starting from the current record to the last record. 3- Retrieve a record: It asks the user to enter a record number and validates the user input. If the user inputs a valid record number, retrieve the record and display it neatly on the screen. Otherwise, display a message indicating the problem and return to the menu. 4- Modify a record: It asks the user for a record number and validates the user input. If the user enters a valid record number, retrieve the record and display it on the screen, allow the user to change zero or more fields of this record, and overwrite the original record in the file with this modified record. If the user enters an invalid record number, display a message indicating the problem and return to the menu.

5- Add a new record: It asks the user to enter data for the new record. This new record will be appended to the end of the random-access file. 6- Delete a record: It asks the user for the record number and validates the user input. If the user inputs a valid record number, delete the specified record from the random access file using a lazy deletion technique. A lazy deletion doesn't really delete the record, but makes it inaccessible to all the subsequent operations. For example, a deleted record can't be retrieved, modified, or displayed. OdEr AInAL SDECIEICATIONS. Tha neacrom OPERATIONAL SPECIFICATIONS: The program should always return to the main menu after processing the selected item. The program execution should only be halted if EXIT is selected from the main menu.

***** I need the code in java and use eclips ****

please send me the screen shot of out put *******

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions