What Is Programming 3

From CompSciWiki
Jump to: navigation, search

COMP 1010 Home > What_Is_Programming_Questions


Introduction

An exercise to determine how many seconds are in various longer units of time.

   

{{{Body}}}

What do you need to know?

  • Standard conversion units per length of time, including some tricky ones, like how many leap years are there in a century.
  • How to compose an output sentence from parts.
  • How to do simple calculation of units.
  • How big an int can be, and when you need to change to a long.

Inputs

  • No inputs from the user are required.
  • Use well-known constants, like the number of seconds in a minute, minutes in an hour, hours in a day, etc.

Outputs

  • The number of seconds in a minute, an hour, a day, a week, a 30-day month, a standard year, a leap-year, a century, a millenium.
  • For example,
There are 60 seconds in a minute
There are 3600 seconds in an hour
There are 86400 seconds in a day
There are 604800 seconds in a week
There are 2592000 seconds in a 30-day month
There are 31536000 seconds in a standard year
There are 31622400 seconds in a leap year
There are 3155673600 seconds in a century
There are 31556822400 seconds in a millenium

Transformation

Starting from well-known constants, figure out all the required outputs.

Solution

Look here.

Template loop detected: Template loop detected: