answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
stepladder [879]
1 year ago
10

"Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de

activates the alarm, and armed which contains a boolean describing whether or not the alarm is activated. Alarm has a function disarm that changes the value of armed to False if the user gives a parameter containing the string that represents the alarm's code. Call the disarm function on the Alarm object myAlarm and give it the code "93478"."
Computers and Technology
1 answer:
Marrrta [24]1 year ago
7 0

Answer:

Following are the program in the Python programming Language.

#define class

class Alarm:

 #define constructor

 def __init__(self,code,armed = False):

   self.code = code #initialize value

   self.armed = armed #initialize value

 #define function

 def changeCode(self,currentCode,newCode):

   #set if conditional statement

   if currentCode == self.code:

     #initialize value if the condition is true

     self.code = newCode

     #return value

     return newCode

#set object of the class and pass value in constructor  

myAlarm=Alarm("93478")

#call and print the function

myAlarm.changeCode("93478","1234")

print(myAlarm.code)

<u>Output</u>:

1234

Explanation:

Here, we define a class "Alarm" and inside the class.

  • Define a constructor and pass arguments in its parameter "code" ,"armed" and assign a boolean value in the variable "armed" to False.
  • Then, initialize the variables inside it.
  • Define the function name "changeCode()" and pass arguments in its parentheses "currentCode" and "newCode" inside it, we set if condition and check whether the "currentCode" is equal to the code the initialize into code the value of "newCode".

Finally, we set an object of the class and pass value in its parentheses for the constructor and then, we call the function and pass values in its parameter then, we print the code.

You might be interested in
How would GIS, GPS, or remote sensing technology be used to evaluate the destruction caused by a tornado in Oklahoma?
emmainna [20.7K]

Answer:

They can be used to compare a certain region before and after disaster.

Explanation:

4 0
2 years ago
A machine is having issues, so the user is responsible for getting the machine serviced. Which stage of the hardware lifecycle d
valentina_108 [34]

Answer:

Maintenance, is the right answer.

Explanation:

A stage where the hardware of a machine is replaced due to some issues which make the machine work inappropriately is called the maintenance stage of the hardware. In this phase, some modifications are made in the hardware to support the operational effectiveness of the hardware. The customer executives try to improve the performance of the system and provide better security during replacing the hardware.

8 0
2 years ago
The icacls.exe command adds __________, which are visible by clicking the Advanced button in the folder Properties dialog box
ella [17]

Answer:

“special” permissions

The icacls.exe command adds “special” permissions, which are visible by clicking the Advanced button in the folder Properties dialog box

8 0
2 years ago
Dr. Robbins wants to know if there are different opinions regarding the value of public school education between Native American
zmey [24]

Answer:

The independent variable is Native American participants

Explanation:

Why Native Americans is the independent variable is bacause the survey population is Native Americans and the result of the survey won't be affected by the gender and age of the native american participants. So it the independent variable.

5 0
2 years ago
3) 5, 10, 15, 20 are items of data. Explain how these could become information and what knowledge
yKpoI14uk [10]

For example when there is research on how many people shoplift in a shopping centre per week. These numbers could show a increase in the number of shoplifters per week.

8 0
1 year ago
Other questions:
  • Software code is tested, debugged, fixed, verified, and then:
    11·1 answer
  • A program needs to allow a customer to input integers until the input number is zero. When the input number is zero, the program
    14·1 answer
  • Gwen recently purchased a new video card, and after she installed it, she realized she did not have the correct connections and
    6·1 answer
  • Define a method named roleOf that takes the name of an actor as an argument and returns that actor's role. If the actor is not i
    8·1 answer
  • Ld' is the instruction with the longest latency on the CPU from Section 4.4 (in RISC-V text). If we modified ld and sd so that t
    15·1 answer
  • Pick a 3D game you enjoy or know about. Pick a scene from that game that has at least one character in it and describe the scene
    9·1 answer
  • A script sets up user accounts and installs software for a machine. Which stage of the hardware lifecycle does this scenario bel
    5·1 answer
  • 1.1.5 practice: analyzing business culture
    13·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
  • A large number of genetic codes are stored as binary values in a list. Which one of the following conditions must be true in ord
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!