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]
2 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]2 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
You were discussing software piracy with a friend and were surprised to learn how software piracy can impact your life every day
Vika [28.1K]
Those who use pirate software:
<span>1)Increase the chances that the software will not function correctly or will fail completely
2)Forfeit access to customer support, upgrades, technical documentation, training, and bug fixes
3)Have no warranty to protect themselves
4)Increase their risk of exposure to a debilitating virus that can destroy valuable data
5)May find that the software is actually an outdated version, a beta (test) version, or a nonfunctioning copy
6)Are subject to significant fines for copyright infringement</span>
5 0
3 years ago
Your mothers date of birth and a unique personal identification number (pin) code provide authentication by _____.
Semenov [28]
Hello <span>Madysonhenders2477 </span><span>

Answer: Your mothers date of birth and a unique personal identification number (pin) code provide authentication by What you are (C)

Since your identification is about who you are, this would be the answer.

Hope This Helps!
-Chris</span>
6 0
2 years ago
What is the best way to catch a particular sporting moment?
pochemuha

Answer:

Know the sport really well so you can anticipate the moment when something exciting might happen. - c

3 0
3 years ago
Read 2 more answers
Slide rule was the first mechanical calculator. true or false​
drek231 [11]

Answer:

False. Pascal's calculator was the first mechanical calculator invented by Blaise Pascal in the mid 17th century.

7 0
3 years ago
Read 2 more answers
Define a class named person that contains two instance variables of type string that stores the first name and last name of a pe
Katarina [22]

Answer:

Answered below

Explanation:

//Program is written using Java programming language.

Class Person {

private string firstName;

private string lastName;

void set firstName(string a){

firstName = a;

}

string getFirstName(){

return firstName;

}

void setLastname( string b){

lastName = b;

}

string getLastName( ){

return lastName;

}

void displayDetails( ) {

System.out.print(firstName);

System.out.print (lastName);

}

}

//Test program

Class Main{

public static void main(String args [] ){

Person person = new Person( )

person.setFirstName("Karen")

System.out.print(person.getFirstName)

person.displayDetails()

}

}

5 0
2 years ago
Other questions:
  • A type of malicious code that appears to be a safe program but that actually has a hidden purpose is called a _____.
    7·2 answers
  • the list of available fonts in the fonts gallery may differ, depending on what fonts you have installed and the type of printer
    14·1 answer
  • What does Data storage enable a browser to do
    5·1 answer
  • Which of the following sets of acronyms is concerned with encoding data for secure transmission?
    11·1 answer
  • 100 tickets are sold in a raffle with one prize. John has 8 tickets, Jamie has 10 tickets, find the probability that John wins
    11·2 answers
  • The use of desktop computer equipment and software to create high-quality documents such as newsletters, business cards, letterh
    14·1 answer
  • What is one benefit of using electronic flash cards?
    13·2 answers
  • Synapse is not working and is crashing every time you attach it. What should you do?
    13·1 answer
  • Find the double word-length 2's complement representation of each of the following decimal numbers:a. 3874
    12·1 answer
  • What do macOS and Windows use to prevent us from accidentally deleting files?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!