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

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Two flowing streams of argon gas are adiabatically mixed to form a single flow/stream. one stream is 1.5 kg/s at 400 kpa and 200 c while the second stream is 2kg/s at 500 kpa and 100 ? . it is stated that the exit state of the mixed single flow of argon gas is 150 c and 300 kpa. assuming there is no work output or input during the mixing process, does this process violate either the first or the second law or both? explain and state all your assumptions.
Answers: 1
question
Engineering, 04.07.2019 18:10
Thermal stresses are developed in a metal when its a) initial temperature is changed b) final temperature is changed c) density is changed d) thermal deformation is prevented e) expansion is prevented f) contraction is prevented
Answers: 2
question
Engineering, 04.07.2019 18:10
An ideal otto cycle with air as the working fluid has a compression ratio of 8. the minimum and maximum temperatures in the cycle are 300 k and 1340 k. use constant specific heats at room temperature to determine (a) the amount of heat transferred to the air during the heat- addition kj/kg, (b) the thermal efficiency, and (c) the thermal efficiency of a carnot cycle ope limits. process, in rating between the same temperature
Answers: 2
question
Engineering, 04.07.2019 19:10
Abarometer contains mercury with a density of 13600 kg/m3. atmospheric conditions are 95.8 kpa and 20 °c at 20 °c, the vapor pressure of the mercury is 0.000173 kpa. the column of mercury will rise to a height of most nearly. select one: a)- 0.38 m b)- 0.82 m c)- 0.48 m d)- 0.72 m
Answers: 1
You know the right answer?
Write a java program that implements a home security policy.

The name of the simulator s...
Questions
question
Mathematics, 31.08.2019 13:00
question
Geography, 31.08.2019 13:00