473,327 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Leap Year Test

8
You can determine whether a year is a leap year by testing if it is divisible by 4.
However, years that are also divisible by 100 are not leap years, unless they are
also divisible by 400, in which case they are leap years. Write a script that
allows a user to enter a year and then determine whether the year entered is a
leap year. Include a form with a single text box where the user can enter a year.
Display an alert dialog box to the user stating whether the year they entered is a
standard year or a leap year.
Jun 14 '07 #1
8 3877
SONIQ
8
Please help me solve this problem

You can determine whether a year is a leap year by testing if it is divisible by 4.
However, years that are also divisible by 100 are not leap years, unless they are
also divisible by 400, in which case they are leap years. Write a script that
allows a user to enter a year and then determine whether the year entered is a
leap year. Include a form with a single text box where the user can enter a year.
Display an alert dialog box to the user stating whether the year they entered is a
standard year or a leap year.

my email address is **** - email removed by MODERATOR
Jun 14 '07 #2
epots9
1,351 Expert 1GB
Posting Homework or Coursework Questions and Answers

first attempt the question and then post parts of your code where u need help with and then we can hlep u.
Jun 14 '07 #3
epots9
1,351 Expert 1GB
Please Do Not Double Post Your Questions
Jun 14 '07 #4
SONIQ
8
Please help me solve this problem.

Using Javascript, I must solve this.

The interface consits of a text box where a year to be tested is entered, a Check for leap year botton. operation, a user enters a year to test and clicks the button a message must appear stating that year is a standard year or a leap year.
(using javascript to solve)

You can determine whether a year is a leap year by testing if it is divisible by 4.
However, years that are also divisible by 100 are not leap years, unless they are
also divisible by 400, in which case they are leap years. Write a script that
allows a user to enter a year and then determine whether the year entered is a
leap year. Include a form with a single text box where the user can enter a year.
Display an alert dialog box to the user stating whether the year they entered is a
standard year or a leap year.

my e-mail address is **** - email removed
Jun 14 '07 #5
SONIQ
8
Posting Homework or Coursework Questions and Answers

first attempt the question and then post parts of your code where u need help with and then we can hlep u.
<html>
<head>
<script language="javascript">
<!--Hide from old browsers
function valYear(myform) {
var Year = document.Leap.Year.value
if (Year == " ") {
alert("Please enter the year you want to test.")
document.Leap.Year.value = " "
document.Leap.Year.focus()
}
}


//-->
</script>

<title>Leap Year Test</title>
</head>
<body>
<form name="Leap">
<table>

<tr>
<td>Year: &nbsp;<input Type="text" name="Year" size="18"></td>
</tr>

<tr>
<td><input Type="Button" value="Check for leap year" onclick="valYear(Leap)"></td>
</tr>
</table>
</form>
</body>
</html>
This is the code form my problem.
Jun 14 '07 #6
epots9
1,351 Expert 1GB
use:
Expand|Select|Wrap|Line Numbers
  1. var leap = Year % 4;
  2. if (leap == 0)
  3. {
  4. //its a leap year code
  5. }
  6. else
  7. {
  8. //its not a leap year code
  9. }
  10.  
u just need to finish it off, to do whatever u need it to do.

good luck
Jun 14 '07 #7
acoder
16,027 Expert Mod 8TB
Merged three threads. As you were informed previously - do not double/triple post.
Jun 14 '07 #8
SONIQ
8
use:
Expand|Select|Wrap|Line Numbers
  1. var leap = Year % 4;
  2. if (leap == 0)
  3. {
  4. //its a leap year code
  5. }
  6. else
  7. {
  8. //its not a leap year code
  9. }
  10.  
u just need to finish it off, to do whatever u need it to do.

good luck

Thanks Problem solved
Jun 15 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Dr John Stockton | last post by:
I'm starting a new thread, for clarity. I'm assuming that it's ECMA-262 3rd Edn (1999) that we should be using for Web pages; that 4th Edn (what's its present status? is it available?) is too...
22
by: deepak.rathore | last post by:
can someone give the regular expr. to validate leap yr like 02/29/2000,02/29/00 Thanks
2
by: owz | last post by:
Ok, I am making a program (java class file) 2 work out if a date entered is valid or invalid for the day, month year, and for leap years.. dd/mm/yyyy . I seem 2 have gotten it 2 validate the year...
8
by: rn216_ccc | last post by:
Hi there all, I found a web site,. http://www.onlineconversion.com/leapyear.htm, where it can give a list of leap years by within the given range by the user, or the user may enter a year and the...
12
by: Brigitte Behrmann | last post by:
Can anyone assist with my code. I just cannot get this to work: I have to write a script that allows the user to enter a year & then determine whether it is a leap year or not. The request is for a...
2
by: cybermom | last post by:
Hi another newbie here I am trying to get the message: The you entered is a leap year, but it does not happen, what did I do wrong with this script? <html> <HEAD> <SCRIPT...
37
by: mazwolfe | last post by:
I'm new here, so excuse me if my style is incorrect. Can anyone come up with a better method for this calculation? Code: int is_leap(int year) { switch (year % 19) { case 0: case 3: case 6:...
5
by: jimix | last post by:
here's what i have. using microsoft studio #define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> int main( void ) { int year, b, c, e; b = 4; c = 100;
4
by: jrw133 | last post by:
Hello. So im a little bit stuck on one of my homework questions. heres the question: Write a C Shell Script that performs the following functions. Asks the user to input a year. The script...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.