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
maxonik [38]
3 years ago
15

3.19 LAB: Seasons In C++ Write a program that takes a date as input and outputs the date's season. The input is a string to repr

esent the month and an int 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:
vlabodo [156]3 years ago
5 0

Answer:

#include <iostream>

#include <string>

using namespace std;

int main() {

  string mth;

int dy;

cin >> mth >> dy;

if ((mth == "January" && dy >= 1 && dy <= 31) || (mth == "February" && dy >= 1 && dy <= 29) || (mth == "March" && dy >= 1 && dy <= 19) || (mth == "December" && dy >= 21 && dy <= 30))

cout << "Winter" << endl;

else if ((mth == "April" && dy >= 1 && dy <= 30) || (mth == "May" && dy >= 1 && dy <= 30) || (mth == "March" && dy >= 20 && dy <= 31) || (mth == "June" && dy >= 1 && dy <= 20))

cout << "Spring" << endl;

else if ((mth == "July" && dy >= 1 && dy <= 31) || (mth == "August" && dy >= 1 && dy <= 31) || (mth == "June" && dy >= 21 && dy <= 30) || (mth == "September" && dy >= 1 && dy <= 21))

cout << "Summer" << endl;

else if ((mth == "October" && dy >= 1 && dy <= 31) || (mth == "November" && dy >= 1 && dy <= 30) || (mth == "September" && dy >= 22 && dy <= 30) || (mth == "December" && dy >= 0 && dy <= 20))

cout << "Autumn" << endl;

else

cout << "Invalid" << endl;

  return 0;

}

Explanation:

You might be interested in
Which of these are correctly formatted Python dictionaries? Check all that apply. dict = {‘Name’: ‘Matthew’, ‘Age’: 14, ‘School’
Advocard [28]

Answer:

A. dict = {‘Name’: ‘Matthew’, ‘Age’: 14, ‘School’: ‘ABC School’}

Explanation:

Since <em>python does not use type when declaring a variable</em>, you must make sure you make your variables correctly or else it won't compile correctly. Lists use braces[]; Strings use quotes, "" or ''; Integers are just declared with a number(s); Dictionaries use brackets{} and inside are <u>attributes of something</u>. For instance, you can use dictionaries to describe ages, {'"Bryan": 6, "Alex": 13, etc.} <u>Sort of like a json file</u>. Dictionaries also tend to use <u>uppercase letters</u> when describing something. The only answer that has all the attributes correct is A. dict = {‘Name’: ‘Matthew’, ‘Age’: 14, ‘School’: ‘ABC School’}

hope i helped :D

7 0
3 years ago
Read 2 more answers
What is the best way to study for an exam?
cupoosta [38]

AnswerB

Explanation:Makes since to look over the notes each night before the exam

8 0
3 years ago
Alcoholism is a chronic disease caused by a dependency on alcohol. Which signs point to alcoholism?
trasher [3.6K]

Answer:

You might experience temporary blackouts and at times memory loss for the short term.

Sudden change in mood, and facing irritability signs

Coming up with excuses for drinking like relaxing, stress, feel normal or deal with stress

keeping distance from friends and various family members

Drinking away from all and in privacy

Suffering from hungover while you are not drinking

Changing group or acquaintances and appearance you usually are with previously

Explanation:

Please check the attachment.

3 0
3 years ago
Read 2 more answers
Which one of the following is the correct code snippet for calculating the largest value in an integer array list aList?
vodka [1.7K]

Answer:

Option a.  int max = aList.get(0); for (int count = 1; count < aList.size(); count++) { if (aList.get(count) > max) { max = aList.get(count); } }

is the correct code snippet.

Explanation:

Following is given the explanation for the code snippet to find largest value in an integer array list aList.

  1. From the array list aList, very first element having index 0 will be stored in the variable max (having data type int).
  2. By using for starting from count =1 to count = size of array (aList), we will compare each element of the array with first element of the array.
  3. If any of the checked element get greater from the first element, it gets replaced in the variable max and the count is increased by 1 so that the next element may be checked.
  4. When the loop will end, the variable max will have the greatest value from the array aList.

i hope it will help you!

7 0
3 years ago
Read 2 more answers
What is the safety for working ina facility that performs xrays?
mylen [45]

Hey and thanks for giving me the chance to serve u

For the nuclear industry, the NRC, amongst other things, dictates exposure limits to both workers dealing with radioactive material, called the occupationally exposed, and the general public, or non-occupationally exposed.  For an occupationally exposed worker, such as someone at a nuclear power plant or in nuclear medicine at a hospital (if they’re licensed by the NRC), the limit is 5 rem a year.  Surprisingly, while most nuclear power workers never receive anywhere close to that amount, some workers in the medical field, such as those working with X-ray fluoroscopy machines, are amongst the highest occupationally exposed workers.  Pregnant women who are occupationally exposed may choose to (but are not required to) declare their pregnancy and receive lower dose limits throughout the term of the pregnancy.

For members of the public, the annual limit from the NRC (which is matched by the EPA for areas not covered by NRC guidelines) is 100 mrem.  Licensed facilities have to have programs in place to limit exposure, and be able to demonstrate that procedures are in place that members of the public would not be exceeding those levels. 

7 0
3 years ago
Other questions:
  • The definition of HTTP makes use of the ASCII character set without reference to how these characters are encoded. Explain why t
    15·2 answers
  • What is a browser? Give one example
    8·2 answers
  • When did internet came to existence?
    12·1 answer
  • Select the proper ergonomic keyboarding techniques.
    15·2 answers
  • Research information technology affects on job market, career pathways, occupational outlooks in business and finance and synthe
    7·1 answer
  • How to cite a website, like asha.org?
    6·1 answer
  • As in algebra, you can use brackets to override the order of operations Excel follows to perform formula calculations. True or f
    13·1 answer
  • !!!!!16 POINTS!!!!Can a computer evaluate an expression to something between true and false? Can you write an expression to deal
    7·1 answer
  • WHICH PROGRAMMING LANGUAGES ARE THE BEST FOR PROGRAMMING?
    14·1 answer
  • The U.S. consumes lots of energy. Which fuel provides the most energy?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!