really need with python code: Adjust the implementation of the the mutator and a
ID: 3535989 • Letter: R
Question
really need with python code:Adjust the implementation of the the mutator and accessor methods. For example, for __init__(hr, min, sec), validate the values, then set __seconds = hr * 60 * 60 + min * 60 + sec. This will store the time as seconds. Adjust all the methods to work with __seconds. getSecond() can use __seconds mod 60 to return only the seconds in the time. really need with python code:
Adjust the implementation of the the mutator and accessor methods. For example, for __init__(hr, min, sec), validate the values, then set __seconds = hr * 60 * 60 + min * 60 + sec. This will store the time as seconds. Adjust all the methods to work with __seconds. getSecond() can use __seconds mod 60 to return only the seconds in the time.
Explanation / Answer
class A: def __init__(hr, min, sec): if( hr>0 && min >0 && sec >0 ): __seconds = hr*60*60 + min*60 +sec def getSecond(): return __seconds
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.