Question: in java Instructions: 1. Ask the user for a year as an input (positive integer - should be between 1500 and 2020, and can include


Instructions: 1. Ask the user for a year as an input (positive integer - should be between 1500 and 2020, and can include 1500 and 2020). 2. If the year input is not between 1500 and 2020, do not check for leap year. Instead, print that this year cannot be checked. 3. If the input year provided by the user is a leap year, print that year is a leap year. Otherwise, print that the year is not a leap year. How to check if a year is a leap year? There are a few things to check: 1. First, if the year can be divided by 4 evenly, it is a leap year. 2. HOWEVER! If the year can be divided by 100 evenly, it is NOT a leap year! (If this occurs, check if the year can divided by 400 evenly. If it is divisible by both 100 evenly, and 400 evenly, it will be considered a leap year.) You'll need to do this to handle centurial years, i.e., years ending in 00, e.g., 1900, 1800, 1700, 2000 etc. Goals 1. Gain experience in input taking using the scanner class in Java. 2. Gain experience in if/else selection statement in Java. Instructions: 1. Ask the user for a year as an input (positive integer - should be between 1500 and 2020, and can include 1500 and 2020). 2. If the year input is not between 1500 and 2020, do not check for leap year. Instead, print that this year cannot be checked. 3. If the input year provided by the user is a leap year, print that year is a leap year. Otherwise, print that the year is not a leap year. How to check if a year is a leap year? There are a few things to check: 1. First, if the year can be divided by 4 evenly, it is a leap year. 2. HOWEVER! If the year can be divided by 100 evenly, it is NOT a leap year! (If this occurs, check if the year can divided by 400 evenly. If it is divisible by both 100 evenly, and 400 evenly, it will be considered a leap year.) You'll need to do this to handle centurial years, i.e., years ending in 00, e.g., 1900, 1800, 1700, 2000 etc. Goals 1. Gain experience in input taking using the scanner class in Java. 2. Gain experience in if/else selection statement in Java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
