Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started