Question: Im having trouble with these two coding problems. Its for Python Question 2 Unlimited tries Suppose there is a class named Alarm. The Alarm class

Im having trouble with these two coding problems. Its for Python
Im having trouble with these two coding problems. Its for Python Question
2 Unlimited tries Suppose there is a class named Alarm. The Alarm

Question 2 Unlimited tries Suppose there is a class named Alarm. The Alarm class has the following two attribute variables: An attribute variable named code which is assigned a string containing the code that deactivates the alarm An attribute variable named armed which is set to True if the alarm is activated, or False if the alarm is not activated. The Alarm class has a method named changeCode that accepts two string arguments, the first containing the current code, and the second containing the new code. If the first argument matches the current code correctly, the value of code is changed to that of the new code. Assume a variable named myAlarn refers to an Alarm object whose current code is '3456". Write a statement that calls the changeCode method, changing the code to "7921" Question 1 Unlimited tries Suppose there is a class named Alarm. The Alarm class has the following two attribute variables: An attribute variable named code which is assigned a string containing the code that deactivates the alarm An attribute variable named armed which is set to True if the alarm is activated, or False if the alarm is not activated. The Alarm class has a method named disarm that accepts one argument: a string containing a deactivation code. It the argument matches the value of the code attribute variable, the disarm method changes the value of the armed attribute variable to False. Assume a variable named myAlarm refers to an Alarm object. Write a statement that calls the disarm method, passing the code 93478 as an argument

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!