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
padilas [110]
3 years ago
11

Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an in

t to represent the day. Ex: If the input is: April 11 the output is: Spring In addition, check if the string and int are valid (an actual month and day). Ex: If the input is: Blue 65 the output is: Invalid The dates for each season are: Spring: March 20 - June 20 Summer: June 21 - September 21 Autumn: September 22 - December 20 Winter: December 21 - March 19
Computers and Technology
1 answer:
ycow [4]3 years ago
8 0

Answer:

import java.util.Scanner;

public class LabProgram {

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String inputMonth = sc.next();

       int inputDay = sc.nextInt();

       if (inputMonth.equals("January") && inputDay >= 1 && inputDay <= 31)

           System.out.println("winter");

       else if (inputMonth.equals("February") && inputDay >= 1 && inputDay <= 29)

           System.out.println("winter");

       else if (inputMonth.equals("April") && inputDay >= 1 && inputDay <= 30)

           System.out.println("spring");

       else if (inputMonth.equals("May") && inputDay >= 1 && inputDay <= 30)

           System.out.println("spring");

       else if (inputMonth.equals("July") && inputDay >= 1 && inputDay <= 31)

           System.out.println("summer");

       else if (inputMonth.equals("August") && inputDay >= 1 && inputDay <= 31)

           System.out.println("summer");

       else if (inputMonth.equals("October") && inputDay >= 1 && inputDay <= 31)

           System.out.println("autumn");

       else if (inputMonth.equals("November") && inputDay >= 1 && inputDay <= 30)

           System.out.println("autumn");

       else if (inputMonth.equals("March") && inputDay >= 20 && inputDay <= 31)

           System.out.println("spring");

       else if (inputMonth.equals("June") && inputDay >= 1 && inputDay <= 20)

           System.out.println("spring");

       else if (inputMonth.equals("June") && inputDay >= 21 && inputDay <= 30)

           System.out.println("summer");

       else if (inputMonth.equals("September") && inputDay >= 1 && inputDay <= 21)

           System.out.println("summer");

       else if (inputMonth.equals("September") && inputDay >= 22 && inputDay <= 30)

           System.out.println("autumn");

       else if (inputMonth.equals("December") && inputDay >= 0 && inputDay <= 20)

           System.out.println("autumn");

       else if (inputMonth.equals("December") && inputDay >= 21 && inputDay <= 30)

           System.out.println("winter");

       else if (inputMonth.equals("March") && inputDay >= 1 && inputDay <= 19)

           System.out.println("winter");

       else

           System.out.println("invalid");

   }

}

You might be interested in
How does 5G technology enhance the Internet of Things (IoT)?
SashulF [63]

Answer:

<em><u>5G Will Quickly Become The New Standard For Cellular Networks. The Internet of Things (IoT) is rapidly developing and expanding. ... 5G will increase cellular bandwidth by huge amounts, making it much easier for the Internet of Things to network large numbers of devices together.</u></em>

Explanation:

Hope its help

5 0
3 years ago
Which Artificial Intelligence (AI) term is used to describe extracting information from unstructured text using algorithms?
Alla [95]

Answer:

The most basic and useful technique in NLP is extracting the entities in the text. It highlights the fundamental concepts and references in the text. Named entity recognition (NER) identifies entities such as people, locations, organizations, dates, etc. from the text.

5 0
3 years ago
Help? brainliest and point
stiks02 [169]

Answer: second one

Explanation:

sorry lol

7 0
3 years ago
Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smalle
almond37 [142]

Answer:

Check the explanation

Explanation:

10

5

3

21

2

-6

the output will be somthing like this:

2 21

You can then suppose that the list of integers will contain at least 2 values.

4 0
3 years ago
your computer is running exceptionally slow. not only does it take the operating system a long time to start, but programs also
aliina [53]

You would want to check for any programs running in the background, as well as run a virus scan.

8 0
3 years ago
Other questions:
  • The numbers on the bottom of a typical check represent all of the following EXCEPT?
    12·2 answers
  • Select the proper ergonomic keyboarding techniques.
    15·2 answers
  • How have search engines like Google, Bing, and Yahoo! revolutionized the ability to do research? They are more difficult to acce
    15·2 answers
  • In addition to training on the products and on company policy, it does not make sense to be prepared to speak about your company
    6·2 answers
  • Binary is best interpreted by a computer because?
    8·2 answers
  • NEED HELP PLEASEE!!!
    9·1 answer
  • An algorithm is defined as a well-ordered collection of unambiguous and effectively computable operations that when executed pro
    10·1 answer
  • Which is a basic job requirement for a career in corrections services?
    13·1 answer
  • Coral Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the a
    6·1 answer
  • Explain the emerging trends in microcomputer technology in relation to size​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!