Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

The ancient Mayans were a civilization in South and Central America that reached its peak in the period of 200-950 A.D. They had a sophisticated

The ancient Mayans were a civilization in South and Central America that reached its peak in the period of 200-950 A.D. They had a sophisticated system for measuring time and the passing of days known as the Long Count, which relies on a cycle of time containing 2,880,000 days, or about 7885 years as we know them today in the Gregorian calendar. The Mayans believed that the entire universe was destroyed and recreated at the end of each cycle.

The Long Count is used to determine the current position in a cycle, as follows:

Mayan Long Count units
Mayan unit Amount of time
1 kin = 1 day
1 uinal = 20 kin (20 days)
1 tun = 18 uinal (360 days)
1 katun = 20 tun (7200 days)
1 baktun = 20 katun (144,000 days)

In writing, representation of the count is formatted with five numbers separated by dots, like this:

image text in transcribed

In this example the date 12.16.11.16.6 represents 12 baktun, 16 katun, 11 tun, 16 uinal and 6 kin. The position in the cycle corresponding to this Long Count date would be calculated as:

12 * 144,000 = 1,728,000 + 16 * 7200 = 115,200 + 11 * 360 = 3,960 + 16 * 20 = 320 + 6 * 1 = 6 Total: 1,847,486 days

This calculation tells us that the date represents 1,847,486 days into the current cycle. Going in the other direction, we must do the reverse -- divide a number of days (1,847,486) into the various long count units.

Assignment in c++

Write two functions to convert between Long Count units and number of days into the current cycle:

  • longCountToDays() should return an int and accept int parameters for the Mayan calendar units.
  • daysToLongCount() should return void, accept an int as the input number of days, and use reference variables to return the converted number of each of the 5 calendar units (baktun, katun, tun, uinal, and kin).

Other requirements:

  • Use a menu to ask the user which conversion they want, and continue asking until an exit is requested.
  • Validate the input and loop continuously with an error message as needed:
    • The end of the cycle is 2,880,000 days. An input number above this does not make sense (it's too high).
    • Negative numbers should not be accepted.
    • Invalid menu entries should not be accepted.
  • The input can be accepted as any C++ data type (string, int, your choice). No need to handle fractional dates or floating point numbers.
  • Identify and use some named constants in your code where possible.
  • Output the conversion as in the example below.

Example Run

Menu ---- 1. Convert Mayan Long Count to days 2. Convert days to Mayan Long Count 3. Exit Your choice? 1 Number of baktun? 12 Number of katun? 16 Number of tun? 11 Number of uinal? 16 Number of kin? 6 The date 12.16.11.16.6 corresponds to 1847486 days into the cycle. Menu ---- 1. Convert Mayan Long Count to days 2. Convert days to Mayan Long Count 3. Exit Your choice? 2 Enter the number of days: 1847486 The conversion is: 12 baktun 16 katun 11 tun 16 uinal 6 kin Menu ---- 1. Convert Mayan Long Count to days 2. Convert days to Mayan Long Count 3. Exit Your choice? 3 Exiting...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions