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
abruzzese [7]
3 years ago
9

Write a program that prompts the user to enter a month (1-12) and year, then displays the number of days in the month. For examp

le, if the user entered month 2 and year 2012, the program would display that February 2012 has 29 days. Be careful with February. If the year entered is a leap year, your output should show that February has 29 days. Use the "Case Study: Determining Leap Year" on p. 105 of Introduction to Java Programming for information on how to calculate the leap year. It does not exactly happen every four years.
Computers and Technology
1 answer:
uysha [10]3 years ago
3 0

Answer:

In Java

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

    int mnth, yr;

 Scanner input = new Scanner(System.in);

 System.out.print("Month: ");  mnth = input.nextInt();

 System.out.print("Year: ");  yr = input.nextInt();

 boolean lpYear = (yr % 4 == 0 && yr % 100 != 0) || (yr % 400 == 0);

 if(mnth == 1 || mnth == 3 || mnth == 5 || mnth== 7 || mnth == 8 || mnth == 10 || mnth == 12){

     System.out.print("31 days");  }

 else if(mnth == 2){

     System.out.print(((lpYear) ? "29 days" : "28 days"));  }

else if(mnth == 9 || mnth == 6 || mnth == 4 || mnth== 11){

     System.out.print("30 days");  }

 else{      System.out.print("Invalid");  }

}

}

Explanation:

See attachment for complete program where comments were used as explanation.

Download txt
You might be interested in
The web server administrator at your e-commerce company is concerned about someone using netcat to connect to the company web se
dangina [55]

Answer:

Banner Grabbing

Explanation:

Banner grabbing is a reconnaissance technique to retrieve information about a computer or about a network and its services. This is used by administrators to take inventory of systems and services on their network.

Banner grabbing is used to gain information about a remote server and is intruders sometimes use this technique to retrieve information about remote servers.  divulge software version numbers and other system information on network hosts. This is a technique of getting software banner information. This information may include operating system information, version and certain services and this helps hackers to attack the network. Banner grabbing can disclose vulnerable applications which can result in service misuse and exploitation.

Banner grabbing is done manually or automatically by using tools. Tools commonly used to perform banner grabbing are Telnet, Wget, nmap, zmap and Netcat etc.

4 0
4 years ago
Write one similarity and one difference between '_' (underscore) ' % ' wildcard symbol .
ale4655 [162]

Answer:

the percentage wildcard is to match the characters from 0to as many as you want

Explanation:

select name from user where name like's%;

8 0
3 years ago
How do you make a 'does not equal' symbol on the computer? you know the equal sign with a line through it..?
Novay_Z [31]
In computer programming, most language use '=' only to assign a value (some use :=). Usually "==" is to compare equality. And "!=" is used for not equal. I checked UTF8 encoding and there's no equal with a line through it character.
5 0
3 years ago
Which of the following configuration files would you document
Nikolay [14]

Answer: B.you have modified a configuration file to mount these new file system automatically

Explanation:

Hope this helped...~DASH

4 0
3 years ago
Write a function all_cats that consumes a comma-separated string of animals and prints whether all of the animals have "cat" in
RoseWind [281]

Answer:

  • Image 1 is for the function defining all_cats():

       (All the explanation is given in comments before each statement)

  • Image 2 has the code for testing the function all_cats()
  • Last image has the output of the code.

8 0
3 years ago
Other questions:
  • The internet is a worldwide assembly of computer
    11·1 answer
  • Briefly explain five measures you have undertaken to protect your confidential
    12·1 answer
  • Multisensory input/output devices, such as data gloves or jumpsuits, are commonly used with _______________ systems.
    12·1 answer
  • What are the characteristics of good blogs?
    8·1 answer
  • Columns, margins and orientation can all be found on what tab?
    15·1 answer
  • ¿Que es un problema para ti?
    7·1 answer
  • Computer programming 5
    10·1 answer
  • Edhesive assignment 1 movie ratings
    9·1 answer
  • What is the result when you run the following program?
    9·2 answers
  • A(n) ________ address is the address that external entities use when communicating with your network.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!