i am doing a software design class for my first year i had a written this psuedocode for a Timer type program type program, my teacher tells me there are errors in it i dont know whats wrong could you tell me please.
here it is

``````Program Timer
Var
mm = integer, dd = integer
BEGIN
PROMPT USER
Leap year = true
Case of MM:
4,6,9,11 :              LAST_DAY = 30
1,3,5,8,10,12:        LAST DAY = 31
2:       do checkLeapyear
if THINGO = true
LAST_DAY = 29
Else
LAST_DAY = 28
End-if
Else: ERROR_FOUND = True
End-case
If ERROR_FOUND = false
If dd <1
or DD > LAST_DAY
ERROR_FOUND = true
End-if
End-if
DISPLAY RESULTS
``````

This is my sub program for leap year

``````SUB CHECKLEAPYEAR
Var
YYYY, quotient, remainder : interger
leap year                         : interger
BEGIN
leap year = false
quotient = yyyy/400
remainder = yyy - (400*quotient)
If remainder = > 0
leap year = false
else
quotient = yyyy / 100
remainder = yyy-(100*quotient)
If remainder = > 0
quotient = yyyy / 4
remainder = yyy - (4*quotient)
If remainder = 0
leap year = false
End-if
End-if
Endif
EndCHECKLEAPYEAR
``````

any advice would be really really nice thanks ^____^

## All 3 Replies

The following is C++ code (for the most part, I'm outta practice)
I searched on the 'net and found the following:
leap years occur in years exactly divisible by four,
except that years ending in 00 are leap years
only if they are divisible by 400.

``````void Calendar&#40;&#41;
&#123;
int month, day, year, last_day; // declare variables
cin >> month; // get month 1-12 from user mm
cin >> day; // get day 1-31 from user dd
cin >> year; // get 4 digit year from user yyyy
switch &#40;month&#41;
&#123;
case 4, 6, 9, 11 &#58; last_day = 30; break;
case 1, 3, 5, 8, 10, 12 &#58; last_day = 31; break;
case 2 &#58;
&#123;
if &#40; checkLeapYear&#40;year&#41; &#41; last_day = 29;
else last_day = 28;
break;
&#125;
default &#58; Error&#40;&#41;;
&#125;
if &#40; &#40;day > last_day&#41; || &#40;day < 1&#41; &#41; Error&#40;&#41;;
&#125;

bool checkLeapYear&#40;int year&#41;
&#123;
bool leap_year = false;
if &#40; &#40;year % 4&#41; == 0&#41; // modular &#40;remainder&#41; division
&#123;
leap_year = true;
if &#40; &#40;year % 1000&#41;&#41; == 0&#41; // year is '00
if !&#40; &#40;year % 400&#41; == 0&#41; leap_year = false;
&#125;
return leap_year;
&#125;``````

ok thanks thanks ^______^ wow .. im finiding software design realllly hard -________- you guys know anything on how to make learning it easier ?

Check the links section (a link is on the top of every TTF page!). There is a very comprehensive C++ e-book for free at http://www.mindview.net. Also, there is a good Java book at that URL.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.