subject
Engineering, 14.02.2020 18:29 rkingmitch8074

Write a java program that implements a home security policy.

The name of the simulator should be secure_home

The policy states that only users with an authorized key can enter the home. To enter the home, the user must first put their key in the lock, then turn the lock, then enter the home, only if the key is valid. A home can be rekeyed with new keys only by the owner, and only if the owner is inside the home.

Firefighters can enter with the secret key (literal string) : FIREFIGHTER_SECRET_KEY

Police can enter as long as their user_name starts with OFFICER_WITH_WARRANT and their key is POLICE_SECRET_KEY.

You must implement the following command-line interface for your server:

./secure_home ...

where is the name of the owner, and through are all authorized keys for the house.

All inputs to the program (keys and names) will be [a-zA-Z0-9_\-] (alphanumeric, underscore, and dash). All matching is case-sensitive.

The input to the program (on standard input)) will be a series of events separated by a newline. The program must track these events and respond appropriately, while enforcing the security policy.

Every input will end in a newline, and every response must end in a newline.

INSERT KEY

User_name inserts key key into the door. Response should be: KEY INSERTED BY

TURN KEY

turns the key in the door. Possible responses are: SUCCESS TURNS KEY or FAILURE UNABLE TO TURN KEY

ENTER HOUSE

enters the house. Possible responses are: ACCESS DENIED or ACCESS ALLOWED.

WHO'S INSIDE?

Who is currently inside the home? Response should be a comma-separated list of user names, ordered by access time (earlier access first): , , ... or NOBODY HOME if there are no users in the home.

CHANGE LOCKS ...

wishes to rekey the home with new given keys , , ..., . Possible responses are: ACCESS DENIED or OK

LEAVE HOUSE

leaves the house. Possible responses are: OK or NOT HERE

If any events are received that are not according to this specification, the response must be: ERROR.

Example Running the program as follows:

./secure_home that lady

Given the input:

INSERT KEY sadaf key

TURN KEY sadaf

ENTER HOUSE sadaf

INSERT KEY that lady

TURN KEY that

ENTER HOUSE that

WHO'S INSIDE?

The program will produce the following output:

KEY key INSERTED BY sadaf

FAILURE sadaf UNABLE TO TURN KEY key

ACCESS DENIED

KEY lady INSERTED BY that

SUCCESS that TURNS KEY lady

ACCESS ALLOWED

that

ansver
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 03.07.2019 23:20, abbz13
Two technicians are discussing the intake air temperature (iat) sensor. technician a says that the computer uses the iat sensor as a backup to the engine coolant temperature (ect) sensor. technician b says that the powertrain control module (pcm) will subtract the calculated amount of fuel if the air measures hot. who is correct
Answers: 3
image
Engineering, 04.07.2019 12:10, Ryantimes2
On a average work day more than work place firs are reorted
Answers: 1
image
Engineering, 04.07.2019 18:10, Strick1530
Which of the following components of a pid controlled accumulates the error over time and responds to system error after the error has been accumulated? a)- proportional b)- derivative c)- integral d)- on/off.
Answers: 2
image
Engineering, 04.07.2019 18:10, Candi9697
A-mn has a cubic structure with a0 0.8931 nm and a density of 7.47 g/cm3. b-mn has a different cubic structure, with a0 0.6326 nm and a density of 7.26 g/cm3. the atomic weight of manganese is 54.938 g/mol and the atomic radius is 0.112 nm. determine the percent volume change that would occur if a-mn transforms to b-mn.
Answers: 2
You know the right answer?
Write a java program that implements a home security policy.

The name of the simulator s...

Questions in other subjects:

Konu
Mathematics, 27.05.2020 00:59
Konu
Computers and Technology, 27.05.2020 00:59
Konu
Chemistry, 27.05.2020 00:59