Question: Problem 1 . 4 The modulo operator is useful for values that loop through a fixed cycle ( like the days of a week or

Problem
1
.
4
The modulo operator is useful for values that loop through a fixed cycle
(
like the days of a week or the minutes in an hour
)
.
Consider an elapsed time of
seconds. We may want to display this as
:
,
where
is the integer number of minutes and
is the number of
seconds
(
0
)
<=
<
(
6
0
)
.
Come up with expressions for
(
)
and
(
)
that calculate these values. Test your expressions by calculating them for tin
{
3
.
5
,
1
2
0
,
1
8
5
,
3
6
1
0
.
5
,
4
1
0
3
8
.
1
3
}
seconds. Optional challenge: Try doing the same for
:
:
,
where
is the integer number of hours and where
0
<=
<
6
0
.
Problem
1
.
5
A classroom has
3
0
numbered seats arranged in six rows and five columns as shown. Col.
1
Col.
2
Col.
3
Col.
4
Col.
5
For any given seat
,
come up with: a
)
An expression
(
)
that calculates the corresponding row number, b
)
An expression
(
)
that calculates
the corresponding column number. Test your expressions by calculating
(
)
and
(
)
for nin
{
1
,
4
,
5
,
1
4
,
2
5
,
2
6
}
.
Hint: Try subtracting
1
from each
seat number then dividing by the number of columns. What do you notice about the results?
student submitted image, transcription available

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!