Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The first line contains the number N the number of files contained in the filesystem. The following N lines contain the file names and allowed

The first line contains the number N the number of files contained in the filesystem. The following N lines contain the file names and allowed operations with them, separated by spaces. The next line contains an integer M the number of operations to the files. The last M lines specify the operations that are requested for files. One file can be requested many times.

You need to recover control over the access rights to the files. For each request, your program should return OK if the requested operation is valid or Access denied if the operation is invalid.

W = write, R = read, X = execute

Example input:

4 helloworld.exe R X pinglog W R nya R goodluck X W R 5 read nya write helloworld.exe execute nya read pinglog write pinglog

example output:

OK Access denied Access denied OK OK

Has to be done in Java and has to use Hashmaps.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres an example implementation in Java that uses HashMap to recover control over the access rights to the files java import javautilHashMap import ja... 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

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions