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
SpyIntel [72]
3 years ago
5

JAVA

Computers and Technology
1 answer:
valentinak56 [21]3 years ago
7 0

Answer:

Following are the code to this question:

import java.util.*;//import package for user input

public class Exercise04_17 //defining class Exercise04_17

{

public static void main(String[] as)//defining the main method  

{

int y,d=0; //defining integer variable

String m;//defining String variable

Scanner oxc=new Scanner(System.in);//creating scanner class object oxc

System.out.print("Enter a year: ");//print message

y=oxc.nextInt();//input year value which store in y variable

System.out.print("Enter a month: ");//print message

m=oxc.next();//input month value which store in m variable

if(m.equals("Jan")||m.equals("Mar")||m.equals("May")||m.equals("Jul")||m.equals("Aug")||m.equals("Oct")||m.equals("Dec"))//defining if block to check Month value

{

d=31;//assign value in d variable

}

if(m.equals("Apr")||m.equals("Jun")||m.equals("Sep")||m.equals("Nov"))//definingif block to check month value

{

d=30;//assign value in d variable

}

if(m.equals("Feb"))//defining if block to check month value is Feb

{

if(y%4==0||y%400==0)//defining if blook to check leap year

{

d=29;//assign value in d variable

}

else//else block

{  

d=28;//assign value in d variable

}

}

if(d!=0)//defining if block that check d variable value not equal to 0

{

System.out.println(m+" "+y+" has "+d+" days");//print inserted value with message

}

else//else block

{

System.out.println(m+" is not a correct month name");//print message

}

}

}

Output:

please find the attachment.

Explanation:

Description of the code:

  • In the above code, two integer variable  "d and y" and one string variable "m" are declared, in which the "y and m" variable is used to input the value from the user end.
  • In the y variable, we simply input the value and print its value, but in the m variable, we input the value and used to check its value by using multiple if blocks and in this, we also check leap year value, and then assign value in "d" variable.
  • In the last step, we print input values with the "d" variable value.

You might be interested in
How does a scriptwriter show the design team how different player actions should affect the game?
Musya8 [376]
Storyboardbhsisiebebhdbebbdud
6 0
3 years ago
How many typefaces should you use in business documents?
Assoli18 [71]
It’s best to use two
5 0
3 years ago
Read 2 more answers
How did people find the first ever piece of tech?
kirill115 [55]
It's not how the found it, it's how they made it.
3 0
4 years ago
Looking for similarities between concepts or problems is referred to as
cestrela7 [59]

Pattern recognition is used  for similarities between concepts or problems in an algorithm.

What is meant by pattern recognition?

Pattern recognition is a data analysis method that uses machine learning algorithms to automatically recognize patterns and regularities in data. This data can be anything from text and images to sounds or other definable qualities. Pattern recognition systems can recognize familiar patterns quickly and accurately.

An example of pattern recognition is classification, which attempts to assign each input value to one of a given set of classes (for example, determine whether a given email is "spam" or "non-spam").

Therefore, Pattern recognition is used.

To know more about Pattern recognition from the given link

brainly.com/question/28427592

#SPJ1

3 0
1 year ago
Which memory will be suitable (a) to Run a software (b) to store a software permanently ?
Katena32 [7]

(a) To run a software => RAM

(b) To store a software => ROM

3 0
3 years ago
Other questions:
  • Simplify (6x+6)+(-3-4x) please hurry!!!!!
    6·1 answer
  • The autofilter sort method works on a(n)____ field(s).
    15·1 answer
  • Suppose we are given an arbitrary digraph G = (V, E) that may or may not be a DAG. Modify the topological ordering algorithm so
    8·1 answer
  • Write the java statement to creat an object mp4 class digital​
    8·1 answer
  • What does the following code print out? (10 points) int[] array = { 1, 4, 3, 6, 8, 2, 5}; int what = array[0]; // scan the array
    14·1 answer
  • Describe conductors and insulators in terms of energy
    11·1 answer
  • GPS data can be used to track the rate and direction of plate movement. If a GPS unit measures a latitude velocity of 28.2 mm/yr
    8·1 answer
  • What is text formatting/
    5·1 answer
  • Which item is developed last in the cyclical design process
    11·1 answer
  • A museum is evaluating historical documents for authenticity, reviewing their physical condition, and categorizing them by subje
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!