Question
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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started