This is what my teacher posted.. .and I HAVE NO CLUE on how to even start it! 1
ID: 440947 • Letter: T
Question
This is what my teacher posted.. .and I HAVE NO CLUE on how to even start it! 1 Kin is 1 Day 1 Uinal is 20 Kin 1 Tun is 18 Uinal 1 Katun is 20 Tun 1 Baktun is 20 Katun All numbers start at 0 and increment to their cycle end and then repeat. Backtuns turn over after 19. The Long Count is written as Baktun.Katun.Tun.Uinal.Kin The first phase of the assignment, your code should display the following [as typed below] [1] Days To Mayan Long Count [2] Mayan Long Count To Days [3] Mayan Calendar Restructured For input 1 - If I give you some integer number of days, I want to see the Mayan Long Count. For 2, if I give you a Mayan Long Count I want to know how many days have passed, and for 3, I want to put in any Long Count and you should format it as a valid Long Count [ie - if I put in 0.0.0.0.100 then you should give me 0.0.0.5.0 First, I want the complete solution in pseudo code then make a working program using Visual basic studio 2010.Explanation / Answer
I have done this for first and second option...
you should study about string split in c++
Hope it will help you a lot :)
kin = 1 days;
uinal = 20 days;
tun = 360 days;
katun = 7200 days;
baktun = 144000 days;
#include
using namespace std;
class MayansCalendar {
public int kin=0;
public uinal=0;
public tun =0;
public katun =0;
public baktun =0;
public:
void getDays2Mayan();
void getMayan2Days();
};
void CRectangle::getDays2Mayan(){
int days;
cout<<"enter the days"< cin>>days;
if(days>144000)
{
baktun=days/144000;
days=days-(baktun*144000);
}
if(days>7200)
{
katun=days/7200;
days=days-(katun*7200);
}
if(days>360)
{
tun=days/360;
days=days-(tun*360);
}
if(days>20)
{
uinal=days/20;
days=days-(uinal*20);
}
if(days<20)
kin=days;
cout<<"Days In mayans is written as :";
cout<
}
void CRectangle::getMayan2Days(){
String mayansForm;
cout<<"enter the mayans long";
cin>>mayansForm;
//split the input string which is seprated by dot.
//Check how to split in c++....
//and then convert each of the sub string to integer using atoi() function
//and finally you can calculate the day.
}
int main () {
MayansCalendar mc;
int choice;
cout<<"Menu"<cout<<"1.Days To Mayan"<cout<<"2.Mayan to Days"<cout<<"enter your choice"<cin>>choice;
switch(choice)
{
case 1:
mc.getDays2Mayan();
break;
case 2:
mc.getMayan2Days();
break;
default:
cout<<"wrong choice";
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.