السلام
ياخواني و ياخواتي.. أريد أسأل اذا حد يعرف يحل اسايمنت 8 ...
Assignment 8 :
Write a program that prompts the user to enter a year and then determines whether it is a leap year. Your program should have a loop and continue while the user enters the character ‘y’.
Write three methods according to the following descriptions:
_ getYear has no formal parameters, asks the user to enter a year, and returns an integer value that is assigned to the integer variable year.
_ isLeap has an integer formal parameter, year, determines whether the year is a leap year, and returns the Boolean value true if the year is a leap year and false if it is not. A year is a leap year if it is divisible by 4, but is not divisible by 100 except when divisible by 400. (The year 2000 was a leap year.)
_ moreData has no formal parameters and returns a char value.
Sample Output:
This program asks you to enter a year in 4 digits.
The output shows if the year is a leap year
Enter a year: 1492
1492 is a leap year.
Do you want to enter more data? y/n y
Enter a year: 2000
2000 is a leap year.
Do you want to enter more data? y/n y
Enter a year: 2005
2005 is not a leap year.
Do you want to enter more data? y/n y
Enter a year: 1800
1800 is not a leap year.
Do you want to enter more data? y/n n