Program 28
Write a class called Time whose only field is a time in seconds.
It should have a method called convert_to_minutes that returns a string
of minutes and seconds formatted as in the following example: if seconds is
230, the method should return '5:50'. It should also have a method called convert_to_hours
that returns a string of hours, minutes, and seconds formatted analogously
to the previous method.
Program:
Output:
No comments:
Post a Comment