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, 04.07.2019 18:10
Consider a large isothermal enclosure that is maintained at a uniform temperature of 2000 k. calculate the emissive power of the radiation that emerges from a small aperture on the enclosure surface. what is the wavelength ? , below which 10% of the emission is concentrated? what is the wavelength ? 2 above which 10% of the emission is concentrated? determine the wavelength at which maximum spectral emissive power occurs. what is the irradiation incident on a small object placed inside the enclosure?
Answers: 2
question
Engineering, 04.07.2019 18:10
True or false (explain) (110)[111] is a slip system in bcc metals . the {111} family in fcc contains 8 planes. resolved shear stress (rss) in single crystals is just related to the applied stress. critical resolved shear stress (crss) in single crystal metals is direct proportional to the number of defects in the structure
Answers: 2
question
Engineering, 04.07.2019 18:10
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 18:20
Steam enters a converging nozzle at 3.0 mpa and 500°c with a at 1.8 mpa. for a nozzle exit area of 32 cm2, determine the exit velocity, mass flow rate, and exit mach number if the nozzle: negligible velocity, and it exits (a) is isentropic (b) has an efficiency of 94 percent
Answers: 2
You know the right answer?
Write a java program that implements a home security policy.

The name of the simulator s...
Questions
question
Mathematics, 26.02.2021 20:30
question
Mathematics, 26.02.2021 20:30
question
Mathematics, 26.02.2021 20:30
question
Mathematics, 26.02.2021 20:30
Questions on the website: 13722361