Write a program that asks the user to enter a year, and then displays whether that year is a leap year or not. Note that a year is a leap year if the year is a multiple of 400, or it is a multiple of 4 and not a multiple of 100.

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 5E: a. Write a program named CheckMonth that prompts a user to enter a birth month. If the value entered...
icon
Related questions
Question

My typed my Java Code & question is screenshot- 

import java.util.Scanner; 
public class SortedNames { 
    public static void main(String[] args) { 
        String name1; 
        String name2; 
        String name3; 
   Scanner keyboard=new Scanner(System.in); 
        System.out.print("Please Enter First Name: "); 
        name1=keyboard.nextLine(); 
        System.out.print("Please Enter Second Name: "); 
        name2=keyboard.nextLine(); 
        System.out.print("Please Enter Third Name: "); 
        name3=keyboard.nextLine(); 

        if((name2.compareToIgnoreCase(name1)<0)&&(name2.compareToIgnoreCase(name3)<0)) 
        { 
            System.out.println(name2); 
        } 

        if((name1.compareToIgnoreCase(name2)<0)&&(name1.compareToIgnoreCase(name3)<0)) 
        { 
            System.out.println(name1); 
        } 

        if((name3.compareToIgnoreCase(name1)<0)&&(name3.compareToIgnoreCase(name2)<0)) 
        { 
            System.out.println(name3); 
        } 
  }      

2. Write a program that asks the user to enter a year, and then displays whether that year is a leap
year or not. Note that a year is a leap year if the year is a multiple of 400, or it is a multiple of
4 and not a multiple of 100.
Transcribed Image Text:2. Write a program that asks the user to enter a year, and then displays whether that year is a leap year or not. Note that a year is a leap year if the year is a multiple of 400, or it is a multiple of 4 and not a multiple of 100.
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,