1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Romashka-Z-Leto [24]
3 years ago
6

Design and implement an application that reads an integer value representing a year from the user. The purpose of the program is

to determine if the year is a leap year (and therefore has 29 days in February) in the Gregorian calendar. A year is a leap year if it is divisible by 4, unless it is also divisible by 100 but not 400. For example, the year 2003 is not a leap year, but 2004 is. The year 1900 is not a leap year because it is divisible by 100, but the year 2000 is a leap year because even though it is divisible by 100, it is also divisible by 400. Produce an error message for any input value less than 1582 (the year the Gregorian calendar was adopted).
Computers and Technology
1 answer:
olga55 [171]3 years ago
4 0

Answer :

Written in java

import java.util.Scanner;

public class Main{

   public static void main(String[] args) {

       int year;

       Scanner scanner = new Scanner(System.in);

       System.out.print("Please enter a year\n\n");

       year = scanner.nextInt();

       while (year < 1582) {

           System.out.print("\nPlease enter a different year above 1582\n");

           year = scanner.nextInt();

       }

       if (year % 4 == 0) {

           if(year % 100 ==0 && year % 400 != 0){

                   System.out.println(year + " is not a leap year\n\n");

           }else {

               System.out.println(year + " is a leap year\n");

           }

       } else {

           System.out.println(year + " is not a leap year\n\n");

       }

   }

}

You might be interested in
When an item is gray that means...
solong [7]

Answer:

B. The item has been selected

8 0
3 years ago
Read 2 more answers
Show a parse tree and a leftmost derivation for : B = C * (A + B)
11111nata11111 [884]

Answer:

mhyfocnu,sobgu,kvngwugwe8hri

Explanation:

sovijbjxyzkuvcg

7 0
3 years ago
The federal government is the largest employer of cybersecurity professionals true or false
Nat2105 [25]

Answer:

ture

Explanation:

because i've harded about it

8 0
4 years ago
What is ur favorite color and why
inysia [295]

Answer:

Sky blueeeee!!

Explanation:

It's the color of my eyes. And I just like it ^^

6 0
3 years ago
Read 2 more answers
Hola buenas tardes, mi problema es el siguiente, en Word quiero alinear los párrafos por separado, pero, así lo sombree una line
Rudik [331]


Usa el botón Tab :)

6 0
3 years ago
Other questions:
  • The following declaration appears in a program: short totalPay, basePay = 500, bonus = 1000; The following statement appears in
    9·1 answer
  • Explain what might happen if two stations are accidentally assigned the same hardware address?
    15·1 answer
  • Which one of the following terms is defined as the material and surfaces upon which an artist works?
    9·1 answer
  • A programmer is writing a system that is intended to be able to store large amounts of personal data. As the programmer develops
    11·1 answer
  • Computer programs and games are called what?
    13·1 answer
  • Smileys Pizzeria has a special on cheese pizza this month. 6- inch personal pizzas are $5, 10-inch small pizzas are $8, 14-inch
    6·1 answer
  • Explain the relevancy of computers in today's global society​
    11·1 answer
  • Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the co
    15·1 answer
  • 1.Blocul care asigura impedanta necesara la intrarea aparatului de masurat numeric este:
    13·1 answer
  • Which of the following shows how to correctly declare pointer variable x?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!