Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program help: Problem Overview This java program will simulate disk allocation methods. The java program will allow the user to choose an allocation method

Java program help:

Problem Overview

This java program will simulate disk allocation methods.

The java program will allow the user to choose an allocation method from among contiguous, linked-list, and indexed allocation methods. It will allow the user to perform disk operations on a simulated disk.

Details

The disk will consist of 256 blocks of 512 bytes each. The first block is for the file allocation table. The second block is a bitmap for free space management. The remaining blocks hold data for the files.

Storage for the disk should be kept in an array. The disk should be its own object with a set of public methods to use it. A disk only knows how to read and write blocks by block number.

File names should be allowed up to at least 8 characters. The maximum file size should be 10 blocks. Files are assumed to be at the root level, and subdirectories are not supported.

A user interface should be written to interact with the disk object and to support the menu options shown below. It is the interface that implements most of the processing, the disk is just a storage device.

The simulation should allow the user to choose the allocation method to use when the simulation begins, either through a menu or as a command line argument. For the chained and indexed allocations, a free block should be randomly chosen. For a contiguous allocation, choose the first contiguous set of blocks large enough for the request.

The user interface should let the user do the following things:

1) Display a file

2) Display the file table

3) Copy a file from the simulation to a file on the real system

4) Copy a file from the real system to a file in the simulation

5) Delete a file

6) Exit

You should handle problems such as not having enough space in an appropriate way.

Sample Output

>program1 contiguous

1) Display a file

2) Display the file table

3) Copy a file from the simulation to a file on the real system

4) Copy a file from the real system to a file in the simulation

5) Delete a file

6) Exit

Choice: 4

Copy from: abc.txt

Copy to: abc.txt

File abc.txt copied

1) Display a file

2) Display the file table

3) Copy a file from the simulation to a file on the real system

4) Copy a file from the real system to a file in the simulation

5) Delete a file

6) Exit

Choice: 2

abc.txt 2 3

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_2

Step: 3

blur-text-image_3

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

5. Describe the impossible trinity.

Answered: 1 week ago