Previous page Next page Navigation bar

Calculator Programming Tutorial

Programming Building Blocks I

Exercises

Clock Hands

Introduction

An analog clock is a device that shows the time of day by moving two pointers, an hour hand and a minute hand, through a circle. The hour hand moves uniformly clockwise through the circle once every twelve hours. The minute hand moves uniformly clockwise through the circle once every hour. The numbers 1 through 12 are arranged around the circumference of the circle such that 12 is at the top, and each number k is 20° counterclockwise from the k+1. At 12:00 midnight, both hands point directly to the 12. At 12:30 AM, the hour hand points midway between the 12 and the 1, and the minute hand points directly at the 6. At 1:00 AM, the hour hand points directly to the 1 and the minute hand points directly to the 12, and so forth.

Part 1

Write a program to determine the angle between the hands of the clock at a specified time. Use any convenient angular measure.

Part 2

At what times of day, to the nearest second, do the hands of the clock point in exactly opposite directions?

Part 3

At what times of day, to the nearest second, do the hands of the clock make a right angle?

Part 4

A second hand is a third pointer that moves uniformly clockwise through the circle once every minute. At 12:00 midnight, all three hands point directly to the 12. Determine how many times per day all three hands of the clock are collinear (either all three pointing exactly in the same direction, or one pointing exactly opposite the other two). Determine how many times per day the hands form one or two right angles (either two pointing exactly in the same direction with the third at a right angle, or two pointing exactly in opposite directions with the third at a right angle).

[ Previous page | Top of page | Next page ]

Previous page Top of page Next page Navigation bar

Copyright © 2002 Brian Hetrick
Page last updated 3 March 2002.

Brian’s Casio Calculator Corner

Home

Programs

Tutorial

Preface

Introduction

Fundamentals

Building Blocks I

Introduction

Comments

Data Types

Numbers

Variables

Expressions

Control Flow I

Control Flow II

Subprograms

Basic I/O

Algorithms

A First Program

Examples

Exercises

Square Roots

Clock Hands

Answers

Modularization

Data Structures I

Recursion

Program Attributes

Building Blocks II

Algorithm Analysis

Structuring

Data Structures II

Abstract Types

Objects

Problem Analysis

Reference Card

References

Puzzles

Site Information

Your Privacy

Site Map

E-mail

Site Technical Data