JAVASCRIPT i need a flowchart and pseudocode Design a progra

JAVASCRIPT, i need a flowchart and pseudocode.

Design a program that will allow the user to input a date value to three variables: month, day and a 4 digit calendar year. Validate the data so that month is 1-12 and so that the day is not less than 1 and not greater than the number of days for the corresponding month. If the month is February, in order to validate the day, call a function that returns a value of true if the year is a leap year and false otherwise. Display a message to the user that confirms the validity of the date or the error that occurred.

A leap year is one that can be evenly divided by 4 unless it is also divisible by 100 OR it is evenly divisible by 400.

To see more about this go to the following link http://www.mathsisfun.com/leap-years.html.

Solution

bool isleapyear(unsigned short year){ return (!(year%4) && (year%100) || !(year%400)); } //1 valid, 0 invalid bool valid_date(unsigned short year,unsigned short month,unsigned short day){ unsigned short monthlen[]={31,28,31,30,31,30,31,31,30,31,30,31}; if (!year || !month || !day || month>12) return 0; if (isleapyear(year) && month==2) monthlen[1]++; if (day>monthlen[month-1]) return 0; return 1; }
JAVASCRIPT, i need a flowchart and pseudocode. Design a program that will allow the user to input a date value to three variables: month, day and a 4 digit cale

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site