Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the following file: Tester.py from clock import Clock myClock = Clock() for i in range(100) : myClock.pulse() print(myClock.getHours()) print(Expected: 1) print(myClock.getMinutes()) print(Expected: 40) for

image text in transcribed

Use the following file:

Tester.py

from clock import Clock myClock = Clock() for i in range(100) : myClock.pulse() print(myClock.getHours()) print("Expected: 1") print(myClock.getMinutes()) print("Expected: 40") for i in range(70) : myClock.pulse() print(myClock.getHours()) print("Expected: 2") print(myClock.getMinutes()) print("Expected: 50") for i in range(1270) : myClock.pulse() print(myClock.getHours()) print("Expected: 0") print(myClock.getMinutes()) print("Expected: 0")
A digital clock shows hours (between 0 and 23) and minutes between 0 and 59). Once a minute, it receives a pulse to advance the time. Complete the Clock class, using instance variables for the hours and minutes. Complete the following file: clock.py 1 ## A simulated digital clock. class Clock : ## Constructs a clock with both the hours and minutes set to 0. def __init__(self) : ## Advances this clock to the next minute. def pulse(self) : ## Gets the hours of this clock. # @return the hours (between 0 and 23) def getHours(self) : ## Gets the minutes of this clock. # @return the minutes (between 0 and 59) W NP def getMinutes (self)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions